2013-10-25 103 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