2013-10-25 101 views
3

首先,我不能使用作曲家因爲我的ISP,所以,我需要一種方法來手動安裝DoctrineFixturesBundle,所以我開始從github下載它,也data-fixtures捆綁。 我在我的項目創建這個文件夾結構如何安裝DoctrineFixturesBundle離線

vendor 
    - doctrine 
    - doctrine-fixtures-bundle 
     - Doctrine 
     - Bundle 
     - FixturesBundle 
      DoctrineFixturesBundle.php 
      ..other files... 


vendor 
    - doctrine 
    - data-fixtures 
     - lib 
     - test 
     composer.json 
     ..other files... 

我通過讀位於每個包內的文件composer.json這樣做,然後我編輯了AppKernel.php並添加

public function registerBundles(){ 
    ..... 
    new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), 
    ..... 
} 

,但它無法正常工作,我總是得到:

Fatal error: Class 'Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle' not 
found in D:\wamp\www\cupon\app\AppKernel.php on line 20 

我錯過了什麼嗎?我可以手動安裝這些軟件包嗎?
希望你能幫助我。 感謝

回答

2

我認爲你需要設置自動加載在composer.json文件:

{ 
    "autoload": { 
     "psr-0": { 
      "Doctrine\\Bundle\\FixturesBundle": "vendor/doctrine/doctrine-fixtures-bundle", 
      "Doctrine\\Common\\DataFixtures": "vendor/doctrine/data-fixtures/lib", 
     } 
    } 
} 

作曲上composer update自動執行此操作,但你並沒有使用作曲家安裝包,沒有這樣做爲這些包。

+2

呵呵你比我快...我還在打字。答案應該有效 - 之後執行'composer dump-autoload -o' - 其他解決方案不需要對composer.json進行任何更改就會暫時將'Doctrine'文件夾移動到'src /' – nifr

+0

有很多'composer.json'在symfony2中,你所在的位置在哪裏?對不起,大聲笑 –

+0

他正在談論位於項目根文件夾中的那個。你的主依賴文件 - 其他文件是由包本身提供的文件。 – nifr