[英]Symfony2 DoctrineFixturesBundle namespace error
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. 我按照要执行的步骤进行操作,将行添加到deps文件,安装它们,在autoload和appkernel中注册它们。
When I try to run even only app/console
, it breaks with: 当我尝试只运行app/console
,它会打破:
Fatal error: Class 'Doctrine\\Bundle\\DoctrineBundle\\Command\\DoctrineCommand' not found in /var/www/.../bundles/Doctrine/Bundle/FixturesBundle/ Command/LoadDataFixturesDoctrineCommand.php on line 40
Which seems right because I don't have a DoctrineBundle directory under Doctrine\\Bundle
, only the DoctrineFixturesBundle
. 这似乎是正确的,因为我没有Doctrine\\Bundle
下的DoctrineBundle目录,只有DoctrineFixturesBundle
。 If I change that line to Symfony\\Bundle\\DoctrineBundle\\...
it works perfectly, because that class resides under that namespace actually. 如果我将该行更改为Symfony\\Bundle\\DoctrineBundle\\...
它完美地工作,因为该类实际上位于该命名空间下。
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. 我搜索了文档,问题,一切,但似乎没有人有同样的问题,所以我必须在这里忽略一些明显的观点。
Any ideas? 有任何想法吗?
Thanks 谢谢
Not long ago, all Doctrine bundles moved to the Doctrine organizaton . 不久前,所有Doctrine捆绑都转移到了Doctrine组织 。 This causes some confusion based on which repository and branch you are using. 这会根据您使用的存储库和分支导致一些混淆。
If you're using Symfony 2.0.x, then your deps
should look something like this: 如果你使用的是Symfony 2.0.x,那么你的deps
应该是这样的:
[DoctrineFixturesBundle]
git=http://github.com/doctrine/DoctrineFixturesBundle.git
target=bundles/Symfony/Bundle/DoctrineFixturesBundle
version=origin/2.0
Notice the target/namespace is actually Symfony\\Bundle\\DoctrineFixturesBundle
. 请注意,目标/命名空间实际上是Symfony\\Bundle\\DoctrineFixturesBundle
。
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. 但是,使用Sytrfony 2.0.x的最新DoctrineFixturesBundle
时不应该有任何问题 - 只要你升级其余的Doctrine依赖项。 You can use this in your deps
instead: 你可以在你的deps
使用它:
[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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.