安装 symfony2 包 (DoctrineCouchDBBundle)

发布于 2024-11-19 18:37:36 字数 1035 浏览 0 评论 0原文

我希望将捆绑包安装到我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

东走西顾 2024-11-26 18:37:36

我将目标更改为

    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()

到 AppKernel 将失败。

详细的设置和配置请参见这里 DoctrineCouchDBBundle Git Hub 问题日志

对于那些不熟悉 Symfony 2 捆绑的人架构,您可能想知道哪些配置键是强制性的并且可用于捆绑包。信息可以从以下来源获得:

    bundle_dir/bundle_name/.../configuration.php

I changed target to

    target= /bundles/Doctrine/Bundle/CouchDBBundle

so now looks like this

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

because I noticed that name space for couchdb bundle is

    namespace Doctrine\Bundle\CouchDBBundle;

therefore adding

    new Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle()

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:

    bundle_dir/bundle_name/.../configuration.php

简单气质女生网名 2024-11-26 18:37:36

更新

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')之上,

因此它应该如下所示:

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

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 be

target=/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:

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

3.) some configuration missing in config.yml

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文