2012-08-30 129 views
0

我試圖運行:問題與symfony的學說2.0

php app/console doctrine:fixtures:load 

但我不斷收到此錯誤:

Fatal error: Class 'Symfony\Bundle\DoctrineFixturesBundle' not found in /Library/WebServer/Documents/Symfony/app/AppKernel.php on line 17 

這裏是我的AppKernel.php:

<?php 

use Symfony\Component\HttpKernel\Kernel; 
use Symfony\Component\Config\Loader\LoaderInterface; 

class AppKernel extends Kernel 
{ 
    public function registerBundles() 
    { 
     $bundles = array(
      new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), 
      new Symfony\Bundle\SecurityBundle\SecurityBundle(), 
      new Symfony\Bundle\TwigBundle\TwigBundle(), 
      new Symfony\Bundle\MonologBundle\MonologBundle(), 
      new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), 
      new Symfony\Bundle\DoctrineBundle\DoctrineBundle(), 
      new Symfony\Bundle\DoctrineFixturesBundle(), 
      new Symfony\Bundle\AsseticBundle\AsseticBundle(), 
      new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), 
      new JMS\SecurityExtraBundle\JMSSecurityExtraBundle(), 
      new Acme\HelloBundle\AcmeHelloBundle(), 
      new Blogger\BlogBundle\BloggerBlogBundle(), 
     ); 

     if (in_array($this->getEnvironment(), array('dev', 'test'))) { 
      $bundles[] = new Acme\DemoBundle\AcmeDemoBundle(); 
      $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); 
      $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); 
      $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); 
     } 

     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

回答

1

您正在使用的燈具束的Symfony的2.1兼容的版本。因爲您正在運行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 

並重新安裝供應商。

+0

所以我修改了你所說的話,並將AppKernel.php上的設置更改爲新的Symfony \ Bundle \ DoctrineFixturesBundle \ DoctrineFixturesBundle(),但它仍然給我那個錯誤 – xonegirlz

+0

它是'target =/bundles/Symfony/Bundle/DoctrineFixturesBundle'無論如何請檢查[DoctrineFixturesBundle文檔](http://symfony.com/doc/current/bundles/DoctrineFixturesBundle/index.html)* Symfony 2.0 * – mgiagnoni

1

你加這個 '教義\ COMMON \ DataFixtures'=>DIR。 '/ .. /供應商/學說,夾具/ lib目錄', 做你autoload.php文件?