【问题标题】:The Symfone "doctrine:fixtures:load" command missingSymfone“教条:固定装置:加载”命令丢失
【发布时间】:2016-12-06 20:56:45
【问题描述】:

我有一个带有 Doctrine 的 Symfony 3.1 项目和 doctrine/doctrine-fixtures-bundledoctrine/data-fixtures 已安装。

但是,当我运行控制台命令时

php bin/控制台原则:fixtures:load

我收到一条消息说doctrine:fixtures 命名空间中没有定义任何命令。

Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand 存在。

请提出解决方法。

【问题讨论】:

    标签: php doctrine-orm doctrine symfony


    【解决方案1】:

    php bin/console 默认环境为PROD

    灯具正确安装是require-dev

    所以正确的函数调用是:

    php bin/console --env=dev doctrine:fixtures:load
    

    【讨论】:

      【解决方案2】:

      rm -rf var/cache 也为我工作(捆绑注册后)

      【讨论】:

        【解决方案3】:

        先运行php bin/console,看看命令是否出现在列表中。

        如果没有,那么您必须在 AppKernel.php 中加载捆绑包

        $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle();
        

        【讨论】:

        • 在我的例子中,我创建了一个新环境,并且必须将它添加到我的 bundles.php 中,如下所示:'staging' => true
        • 感谢@VaelVictus 你救了我。
        【解决方案4】:

        Data Fixtures Mechanism 需要一个特殊的捆绑包。默认情况下它不包含在 Sf 中。

        检查:http://symfony.com/doc/current/bundles/DoctrineFixturesBundle/index.html 并安装它。

        Bundle 称为 DoctrineFixturesBundle。您还可以找到许多有用的信息如何使用固定装置。

        这就是为什么您会收到消息“命令未定义”。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-10-07
          • 1970-01-01
          • 1970-01-01
          • 2016-03-24
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多