安装 symfony2 包 (DoctrineCouchDBBundle)
我希望将捆绑包安装到我的 symfony 项目中。但是,我遇到了一些问题。如果答案微不足道,请接受我的无知,但我已经尝试寻找解决方案,但可惜的是,我什么也没找到。
在我的 deps 文件中,我有:
[doctrine-couchdb]
git=http://github.com/doctrine/couchdb-odm.git
[DoctrineCouchDBBundle]
git=http://github.com/doctrine/DoctrineCouchDBBundle.git
target=/bundles/Symfony/Bundle/DoctrineCouchDBBundle
我运行 bin/vendors install 命令
在我的 autoload.php 文件中,我有:
'Doctrine\\ODM\\CouchDB'=> __DIR__.'/../vendor/doctrine-couchdb/lib',
我已经注册捆绑包:
new Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle()
当我运行 php app/console 时,出现错误:
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 存储库?你用过这个捆绑包吗?
I wish to install the bundle into my symfony project. However, I am coming across a few issues. Please accept my ignorance if the answer is trivial but I've tried searching for a solution but alas, I've found nothing.
In my deps file, I have:
[doctrine-couchdb]
git=http://github.com/doctrine/couchdb-odm.git
[DoctrineCouchDBBundle]
git=http://github.com/doctrine/DoctrineCouchDBBundle.git
target=/bundles/Symfony/Bundle/DoctrineCouchDBBundle
I run the bin/vendors install command
In my autoload.php file I have:
'Doctrine\\ODM\\CouchDB'=> __DIR__.'/../vendor/doctrine-couchdb/lib',
I've registered the bundle:
new Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle()
When I run php app/console I get the error:
Fatal error: Class 'Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle' not found in /var/www/symfony2.test/app/AppKernel.php on line 22
I've noticed that for MongoDB ODM you have:
[doctrine-mongodb]
git=http://github.com/doctrine/mongodb.git
is there not a doctrine-couchdb repo? Have you used this bundle?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我将目标更改为
现在看起来像这样,
因为我注意到,如果安装位置与名称空间/类名不匹配,则 couchdb 包的名称空间
因此添加
到 AppKernel 将失败。
详细的设置和配置请参见这里 DoctrineCouchDBBundle Git Hub 问题日志
对于那些不熟悉 Symfony 2 捆绑的人架构,您可能想知道哪些配置键是强制性的并且可用于捆绑包。信息可以从以下来源获得:
I changed target to
so now looks like this
because I noticed that name space for couchdb bundle is
therefore adding
to AppKernel will fail, if installation location does not match namespace/class_name.
Detailed setup and configuration here DoctrineCouchDBBundle Git Hub Issue Log
For those that are new to Symfony 2 bundling architecture, you probably wonder what configuration keys are mandatory and available for bundles. Info can be obtained from:
更新:
1.) 检查您是否还安装并自动加载了
Doctrine\CouchDB
2.) 在 git 安装中
target=/bundles/Symfony/Bundle/DoctrineCouchDBBundle
可能应该是target=/bundles/Doctrine/Bundle/DoctrineCouchDBBundle
(注意 Symfony => 学说)3.) 然后更改
'学说' => __DIR__.'/../vendor/doctrine/lib',
到
'Doctrine' => array(__DIR__.'/../vendor/doctrine/lib', __DIR__.'/../vendor/bundles'),
从我的脑海中我会假设这些事情:
1.)缓存
2.)
'Doctrine\\ODM\\CouchDB'=> __DIR__.'/../vendor/doctrine-couchdb/lib',
应该位于任何更高级别的命名空间('Doctrine'、'Doctrine\Common')之上,
因此它应该如下所示:
3.)config.yml 中缺少某些配置
Update :
1.) Check that you also have installed and autoloaded
Doctrine\CouchDB
2.) in your git installation
target=/bundles/Symfony/Bundle/DoctrineCouchDBBundle
should probably betarget=/bundles/Doctrine/Bundle/DoctrineCouchDBBundle
(notice Symfony => Doctrine)3.) Then change
'Doctrine' => __DIR__.'/../vendor/doctrine/lib',
to
'Doctrine' => array(__DIR__.'/../vendor/doctrine/lib', __DIR__.'/../vendor/bundles'),
Off the top of my head I'd assume either these things:
1.) Cache
2.)
'Doctrine\\ODM\\CouchDB'=> __DIR__.'/../vendor/doctrine-couchdb/lib',
should be above any higher level namespaces ('Doctrine', 'Doctrine\Common')
so it should look like this:
3.) some configuration missing in config.yml