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

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

问题描述

我无法解决固定装置包的一个大问题.一世按照应遵循的步骤进行操作,将行添加到deps 文件,安装它们,在自动加载中注册它们和应用内核.

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:

致命错误:类 'DoctrineBundleDoctrineBundleCommandDoctrineCommand'在/var/www/.../bundles/Doctrine/Bundle/FixturesBundle/中找不到第 40 行的 Command/LoadDataFixturesDoctrineCommand.php

这似乎是正确的,因为我没有 DoctrineBundle 目录在 DoctrineBundle 下,只有 DoctrineFixturesBundle.如果我将该行更改为 SymfonyBundleDoctrineBundle... 它可以工作完美,因为该类实际上位于该名称空间下.

Which seems right because I don't have a DoctrineBundle directory under DoctrineBundle, only the DoctrineFixturesBundle. If I change that line to SymfonyBundleDoctrineBundle... 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.

有什么想法吗?

谢谢

推荐答案

不久前,所有 Doctrine 包移到了 Doctrine 组织.根据您使用的存储库和分支,这会导致一些混淆.

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

注意目标/命名空间实际上是 SymfonyBundleDoctrineFixturesBundle.

Notice the target/namespace is actually SymfonyBundleDoctrineFixturesBundle.

然而,使用最新的 DoctrineFixturesBundle 和 Symfony 2.0.x 应该不会有任何问题——只要你也升级其余的 Doctrine 依赖项.您可以在 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天全站免登陆