2011-07-14 32 views
5

我希望將這個包安裝到我的symfony項目中。但是,我遇到了一些問題。如果答案不重要,請接受我的無知,但我試過尋找解決方案,但唉,我什麼也沒找到。安裝一個symfony2包(DoctrineCouchDBBundle)

在我DEPS文件,我有:

[doctrine-couchdb] 
    git=http://github.com/doctrine/couchdb-odm.git 
[DoctrineCouchDBBundle] 
    git=http://github.com/doctrine/DoctrineCouchDBBundle.git 
    target=/bundles/Symfony/Bundle/DoctrineCouchDBBundle 

我運行斌/廠商安裝命令

在我autoload.php文件我有:

'Doctrine\\ODM\\CouchDB'=> __DIR__.'/../vendor/doctrine-couchdb/lib', 

我已註冊該軟件包:

new Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle() 

當我運行PHP應用程序/控制檯我得到的錯誤:

Fatal error: Class 'Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle' not found in /var/www/symfony2.test/app/AppKernel.php on line 22 

我注意到,MongoDB的ODM您有:

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

是不是有一個doctrine- couchdb回購?你用過這個包嗎?

回答

1

我改變目標

 

    target= /bundles/Doctrine/Bundle/CouchDBBundle 

所以現在看起來是這樣的

 

    [DoctrineCouchDBBundle] 
     git=http://github.com/doctrine/DoctrineCouchDBBundle.git 
     target=/bundles/Doctrine/Bundle/CouchDBBundle 

,因爲我注意到了,CouchDB的軟件包的名稱空間是

 

    namespace Doctrine\Bundle\CouchDBBundle; 

因此增加

 

    new Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle() 

如果安裝位置不匹配namespace/class_name,則AppKernel將失敗。

詳細設置,在這裏DoctrineCouchDBBundle Git Hub Issue Log

對於那些新來的Symfony 2捆綁架構配置,你可能想知道什麼樣的配置項是強制性的,可用於捆綁。

 

    bundle_dir/bundle_name/.../configuration.php 

1

更新

1)檢查是否也已安裝並使用Gi​​t的安裝自動加載Doctrine\CouchDB

2)

target=/bundles/Symfony/Bundle/DoctrineCouchDBBundle也許應該

target=/bundles/Doctrine/Bundle/DoctrineCouchDBBundle(公告Symfony =>學說)

3)然後換

'Doctrine' => __DIR__.'/../vendor/doctrine/lib',

'Doctrine' => array(__DIR__.'/../vendor/doctrine/lib', __DIR__.'/../vendor/bundles'),


關閉我的頭頂,我認爲這兩種東西:

1)高速緩存

2.)'Doctrine\\ODM\\CouchDB'=> __DIR__.'/../vendor/doctrine-couchdb/lib', 應高於任何更高級別的命名空間(「主義」,「主義\共同」)

所以它應該是這樣的:

'Doctrine\\ODM\\CouchDB'=> __DIR__.'/../vendor/doctrine-couchdb/lib', 
'Doctrine\\DBAL' => __DIR__.'/../vendor/doctrine-dbal/lib', 
'Doctrine'   => __DIR__.'/../vendor/doctrine/lib', 

3)一些配置中配置丟失。陽明海運

+0

試過這個建議,但它並沒有:-( – Flukey

+0

可能是一個愚蠢的問題也工作,但你有沒有其他地方像學說\捆綁和學說\ CouchDB的自動加載 – Inoryy

+0

:信息可以從獲得?應該不是'target =/bundles/** Symfony **/Bundle/DoctrineCouchDBBundle'實際上是'target =/bundles/** Doctrine **/Bundle/DoctrineCouchDBBundle'? – Inoryy