我尝试安装现有的 Symfony 2.0 项目,因此我运行 rm -rf vendor 和 bin/vendor install。他找不到 DoctrineFixturesBundle,所以我更新了我的 deps 文件并输入:
[DoctrineFixturesBundle]
git=https://github.com/doctrine/DoctrineFixturesBundle.git
target=/bundles/Symfony/Bundle/DoctrineFixturesBundle
version=origin/2.0
我再次运行 rm -rf vendor/* 和 bin/vendor install,我得到这个错误:
自动加载器期望类“Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesBundle”在文件“/home/me/developpement/myproject/app/../vendor/bundles/Symfony/Bundle/DoctrineFixturesBundle/DoctrineFixturesBundle.php”中定义。找到文件但类不在其中,类名或命名空间可能有错字。
所以,在我的 AppKernel.php 我替换:
new Symfony\Bundle\DoctrineFixturesBundle\DoctrineFixturesBundle(),
和 :
new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
因为 DoctrineFixturesBundle.php 文件命名空间是 Doctrine\Bundle\FixturesBundle。
现在,我收到此错误:
致命错误:在第 21 行的 /home/me/developpement/myproject/app/AppKernel.php 中找不到类 'Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle'
我应该怎么做才能让它工作?
编辑添加:
这是我的 autoload.php :
$loader->registerNamespaces(array(
'Symfony' => array(__DIR__.'/../vendor/symfony/src', __DIR__.'/../vendor/bundles'),
'Sensio' => __DIR__.'/../vendor/bundles',
'JMS' => __DIR__.'/../vendor/bundles',
'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib',
'Doctrine\\DBAL' => __DIR__.'/../vendor/doctrine-dbal/lib',
'Doctrine' => __DIR__.'/../vendor/doctrine/lib',
'Monolog' => __DIR__.'/../vendor/monolog/src',
'Assetic' => __DIR__.'/../vendor/assetic/src',
'Metadata' => __DIR__.'/../vendor/metadata/src',
'Gedmo' => __DIR__.'/../vendor/gedmo-doctrine-extensions/lib',
'Doctrine\\Common\\DataFixtures' => __DIR__.'/../vendor/doctrine-fixtures/lib',
'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib',
'Doctrine\\DBAL\\Migrations' => __DIR__.'/../vendor/doctrine-migrations/lib',
'Doctrine\\DBAL' => __DIR__.'/../vendor/doctrine-dbal/lib',
'Knp\Component' => __DIR__.'/../vendor/knp-components/src',
'Knp\Bundle' => __DIR__.'/../vendor/bundles',
));