2012-08-03 77 views
0

我想手動添加DoctrineFixturesBundle到我的symfony項目,當我這樣做時,我得到以下錯誤。Symfony2 - DoctrineFixturesBundle - DoctrineCommand not found

C:\wwwnet\symfony>php app/console doctrine:fixtures:load 

Fatal error: Class 'Doctrine\Bundle\DoctrineBundle\Command\DoctrineCommand' not found in C:\wwwnet\symfony\vendor\bundles\Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand.php on line 34 

我已經按照我加入這裏How to install a Symfony 2.0 Bundle from Zip file

林立在我AppKernel步驟進行:

$bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(); 

在自動加載,我有:

'Doctrine\\Bundle' => __DIR__.'/../vendor/bundles', 
//'Symfony\\Bundle\\DoctrineFixturesBundle' => __DIR__.'/../vendor/bundles', 
//'Doctrine\\Bundle\\DoctrineFixturesBundle' => __DIR__.'/../vendor/bundles', 
'Doctrine\\Common\\DataFixtures' => __DIR__.'/../vendor/doctrine-fixtures/lib', 
'Doctrine\\Common' => __DIR__.'/../vendor/doctrine-common/lib', 
'Doctrine\\DBAL' => __DIR__.'/../vendor/doctrine-dbal/lib', 
'Doctrine'   => __DIR__.'/../vendor/doctrine/lib', 

我已經加入捆綁到:

C:\wwwnet\symfony\vendor\bundles\Doctrine\Bundle\FixturesBundle 

我已經看到了這個問題Symfony2 DoctrineFixturesBundle namespace error,看來我可能使用2.1包2.0 symfony的建議

此外,DoctrineBundle永遠不會在原則\包命名空間,只要你在Symfony 2.0.x上。 Symfony 2.0.x隨捆綁\ Symfony下的DoctrineBundle一起提供。你的問題是你正在嘗試使用DoctrineFixturesBundle的新版本,該版本需要Doctrine \ Bundle下的DoctrineBundle。我的第一個建議,標籤捆綁版本=起源/ 2.0應該解決這個問題。 - 韭菜3月11日20:22

我該如何抓取2.0包,爲https://github.com/doctrine/DoctrineFixturesBundle?如果那就是問題,那麼我就在這個黑暗中,並且已經漫無目的地抓了我兩天了。

  • 的Symfony:Symfony_Standard_Vendors_2.0.16
  • PHP:5.3.6
  • 阿帕奇:2.2

回答

0

在你DEPS文件中添加

[doctrine-fixtures] 
    git=http://github.com/doctrine/data-fixtures.git 

[DoctrineFixturesBundle] 
    git=http://github.com/doctrine/DoctrineFixturesBundle.git 
    target=/bundles/Symfony/Bundle/DoctrineFixturesBundle 
    version=origin/2.0 

所以你在定義版本最後一行,在此之後執行bin/vendor update

+0

感謝您的回覆,上次我做了一次供應商更新,它刪除了我的代碼庫。無論如何要爲DoctrineFixturesBundle 2.0版本執行手動下載? – lookbadgers 2012-08-04 16:46:57

+0

拉分支2.0然後放在廠商文件夾,應該做的伎倆。 – amitchhajer 2012-08-04 17:07:22

+0

謝謝你的訣竅 – lookbadgers 2012-08-06 07:51:19