2013-02-06 31 views
2

我下面這個教程:http://tutorial.symblog.co.uk/docs/extending-the-model-blog-comments.html#doctrine-2-migrationsSymfony的2.1.7和學說的遷移包錯誤

1)安裝學說遷移捆綁

1.1) - 加入

"doctrine/migrations": "dev-master", 
"doctrine/doctrine-migrations-bundle": "dev-master" 

到composer.json

1.2)運行

php composer.phar update 

2)AppKernel.php

3)加入

new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), 

運行

php app/console doctrine:migrations:diff 

這應該運行的命令,並查找當前實體和數據庫之間的差異,是嗎? 但我得到一個錯誤,而不是:

Fatal error: Class 'Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle' not found in D:\xampp\htdocs\symblog.dev\app\AppKernel.php on line 23 

這也正是(2)

行你能幫助我嗎?歡迎任何建議!

+1

你有沒有運行'php composer.phar update'的問題? – cheesemacfly

+0

作曲家沒有問題,捆綁安裝好了,但是當我將它們添加到AppKernel.php時,它會打散; P –

回答

3

我認爲這個包在此期間被重新命名。嘗試:(更新問題):

// app/AppKernel.php 
public function registerBundles() 
{ 
    $bundles = array(
     //... 
     new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), 
    ); 
} 

DoctrineMigrationsBundle documentationDoctrineMigrationsBundle class

+0

我在我的問題中粘貼了錯誤的命名空間/類。現在修復。 AppKernel的內容是exaclty,如你所說..將添加來源。 –

+0

謝謝你的回答,檢查了手冊 - 沒有用,試過2.1手動和主分支 - 也 這裏是應用內核:[pastebin](http://pastebin.com/Gfbqp0N3)composer.json:[bastebin ](http://pastebin.com/ch9nYN37) 我已經安裝在vendor/doctrine中的兩個包: - doctrine-fixtures-bundle和doctrine-migrations-bundle,它們都不起作用。與燈具幾乎相同的問題。 –

+2

@dopamine嘗試運行'composer dump-autoload'。 – gremo