我正在尝试运行:
php app/console doctrine:fixtures:load
但我经常收到这样的错误:
Fatal error: Class 'SymfonyBundleDoctrineFixturesBundle' not found in /Library/WebServer/Documents/Symfony/app/AppKernel.php on line 17
这是我的AppKernel.php:
<?php
use SymfonyComponentHttpKernelKernel;
use SymfonyComponentConfigLoaderLoaderInterface;
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
new SymfonyBundleFrameworkBundleFrameworkBundle(),
new SymfonyBundleSecurityBundleSecurityBundle(),
new SymfonyBundleTwigBundleTwigBundle(),
new SymfonyBundleMonologBundleMonologBundle(),
new SymfonyBundleSwiftmailerBundleSwiftmailerBundle(),
new SymfonyBundleDoctrineBundleDoctrineBundle(),
new SymfonyBundleDoctrineFixturesBundle(),
new SymfonyBundleAsseticBundleAsseticBundle(),
new SensioBundleFrameworkExtraBundleSensioFrameworkExtraBundle(),
new JMSSecurityExtraBundleJMSSecurityExtraBundle(),
new AcmeHelloBundleAcmeHelloBundle(),
new BloggerBlogBundleBloggerBlogBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new AcmeDemoBundleAcmeDemoBundle();
$bundles[] = new SymfonyBundleWebProfilerBundleWebProfilerBundle();
$bundles[] = new SensioBundleDistributionBundleSensioDistributionBundle();
$bundles[] = new SensioBundleGeneratorBundleSensioGeneratorBundle();
}
return $bundles;
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml');
}
}
这是我的代表文件中与条令有关的一部分:
[doctrine-common]
git=http://github.com/doctrine/common.git
version=2.2.0
[doctrine-dbal]
git=http://github.com/doctrine/dbal.git
version=2.2.1
[doctrine]
git=http://github.com/doctrine/doctrine2.git
version=2.2.0
[doctrine-fixtures]
git=http://github.com/doctrine/data-fixtures.git
[DoctrineFixturesBundle]
git=http://github.com/doctrine/DoctrineFixturesBundle.git
target=bundles/Doctrine/Bundle/FixturesBundle
我在Symfony 2.0 上
您使用的是与Symfony 2.1兼容的Fixtures捆绑包版本。因为您运行的是Symfony 2.0,所以需要使用FixturesBundle的2.0兼容分支,该分支恰好命名为2.0。
更改deps文件:
[DoctrineFixturesBundle]
git=http://github.com/doctrine/DoctrineFixturesBundle.git
target=bundles/Doctrine/Bundle/FixturesBundle
version=origin/2.0
并重新安装供应商。
您添加了这个吗'Doctrine\Common\DataFixtures'=>DIR.//供应商/条令固定装置/lib’,是否自动加载.php文件?