Php 如何脱机安装DoctrineFixturesBundle
首先,由于我的ISP,我无法使用composer,因此,我需要一种手动安装Php 如何脱机安装DoctrineFixturesBundle,php,symfony,bundle,Php,Symfony,Bundle,首先,由于我的ISP,我无法使用composer,因此,我需要一种手动安装DoctrineFixturesBundle的方法,因此我开始从github下载它,也就是data fixtures捆绑包。 我在项目中创建此文件夹结构 vendor - doctrine - doctrine-fixtures-bundle - Doctrine - Bundle - FixturesBundle DoctrineFixtur
DoctrineFixturesBundle
的方法,因此我开始从github
下载它,也就是data fixtures
捆绑包。
我在项目中创建此文件夹结构
vendor
- doctrine
- doctrine-fixtures-bundle
- Doctrine
- Bundle
- FixturesBundle
DoctrineFixturesBundle.php
..other files...
vendor
- doctrine
- data-fixtures
- lib
- test
composer.json
..other files...
为此,我读取了每个包中的composer.json文件,然后编辑了AppKernel.php
并添加了
public function registerBundles(){
.....
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
.....
}
但它不起作用,我总是得到:
Fatal error: Class 'Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle' not
found in D:\wamp\www\cupon\app\AppKernel.php on line 20
我错过什么了吗?我可以手动安装这些捆绑包吗?希望你能帮助我。
谢谢我认为您需要在
composer.json
文件中设置自动加载:
{
"autoload": {
"psr-0": {
"Doctrine\\Bundle\\FixturesBundle": "vendor/doctrine/doctrine-fixtures-bundle",
"Doctrine\\Common\\DataFixtures": "vendor/doctrine/data-fixtures/lib",
}
}
}
Composer会在
Composer update
上自动执行此操作,但由于您没有使用Composer安装软件包,因此这些软件包没有执行此操作。呵呵,您比我快。。。我还在打字。答案应该有效-之后执行composer dump autoload-o
-其他不需要对composer.json进行任何更改的解决方案将临时将doctor
文件夹移动到src/
在symfony2中有很多composer.json
,您正在谈论的那个在哪里?抱歉,他说的是位于项目根文件夹中的那个。您的主要依赖文件-其他文件是由软件包自己提供的。现在它正在工作!!!!!在我做了@Wouter J建议的更改后,我尝试了,但没有成功,因此,我运行了@nifr建议的composer dump autoload-o
,即使我不知道它做了什么,现在一切都很正常,感谢该命令将重新创建类映射,告诉自动加载程序在哪里可以找到您的类,即vendor/autoload.php
,以及vendor/composer
文件夹中的文件:)祝您编码愉快!