Symfony2 DoctrineFixturesBundle namespace error(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 命名空间错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Symfony2 DoctrineFixturesBundle 命名空间错误
基础教程推荐
- 在PHP中根据W3C规范Unicode 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- 如何替换eregi() 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
