Symfony2 DoctrineFixturesBundle命名空间错误 [英] Symfony2 DoctrineFixturesBundle namespace error

查看:126
本文介绍了Symfony2 DoctrineFixturesBundle命名空间错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个很大的问题,灯具束,我无法解决。 I
按照要遵循的步骤进行操作,将这些行添加到
deps文件,安装它们,在autoload和
appkernel中注册它们。

I have a big problem with the fixtures bundle which I can't resolve. I follow the steps as they are meant to be followed, adding the lines to the deps file, installing them, registering them in the autoload and appkernel.

当我尝试运行 app / console 时,它会与:

When I try to run even only app/console, it breaks with:

致命错误:Class'Doctrine\Bundle\DoctrineBundle\Command\DoctrineCommand'
未在/var/www/.../bundles中找到/ Doctrine / Bundle / FixturesBundle /
第40行命令/ LoadDataFixturesDoctrineCommand.php

哪个是正确的,因为我没有一个DoctrineBundle目录
Doctrine\Bundle 下,只有 DoctrineFixturesBundle
如果我将该行更改为 Symfony\Bundle\DoctrineBundle\ ... ... 它完美地运行
,因为该类位于该命名空间下其实。

Which seems right because I don't have a DoctrineBundle directory under Doctrine\Bundle, only the DoctrineFixturesBundle. If I change that line to Symfony\Bundle\DoctrineBundle\... it works perfectly, because that class resides under that namespace actually.

当然我不能这样说。
我搜索文档,问题,一切,但似乎
,没有人有这个同样的问题,所以我必须在这里缺少一些明显的
点。

Of course I can't leave it that way. I searched through the documentation, issues, everything, but it seems that noone has this same issue, so I must be missing some obvious point here.

任何想法?

谢谢

推荐答案

不久前,所有原则束移到了教义组织。这将导致基于您使用的存储库和分支的一些混淆。

Not long ago, all Doctrine bundles moved to the Doctrine organizaton. This causes some confusion based on which repository and branch you are using.

如果您使用Symfony 2.0.x,那么您的 deps 应该看起来像这样:

If you're using Symfony 2.0.x, then your deps should look something like this:

[DoctrineFixturesBundle]
    git=http://github.com/doctrine/DoctrineFixturesBundle.git
    target=bundles/Symfony/Bundle/DoctrineFixturesBundle
    version=origin/2.0

注意目标/命名空间实际上是 Symfony\Bundle\DoctrineFixturesBundle

Notice the target/namespace is actually Symfony\Bundle\DoctrineFixturesBundle.

但是,只要您升级了,就不要在Symfony 2.0.x中使用最新的 DoctrineFixturesBundle 其余的理论依赖也是。您可以在 deps 中使用它:

However, you shouldn't have any problems using the latest DoctrineFixturesBundle with Symfony 2.0.x - as long as you upgrade the rest of the Doctrine dependencies also. You can use this in your deps instead:

[doctrine-common]
    git=http://github.com/doctrine/common.git
    version=2.2.0

[doctrine-dbal]
    git=http://github.com/doctrine/dbal.git
    version=2.2.1

[doctrine]
    git=http://github.com/doctrine/doctrine2.git
    version=2.2.0

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

[DoctrineFixturesBundle]
    git=http://github.com/doctrine/DoctrineFixturesBundle.git
    target=bundles/Doctrine/Bundle/FixturesBundle

这篇关于Symfony2 DoctrineFixturesBundle命名空间错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆