1. <legend id='6SALc'><style id='6SALc'><dir id='6SALc'><q id='6SALc'></q></dir></style></legend>

      <tfoot id='6SALc'></tfoot>
    2. <i id='6SALc'><tr id='6SALc'><dt id='6SALc'><q id='6SALc'><span id='6SALc'><b id='6SALc'><form id='6SALc'><ins id='6SALc'></ins><ul id='6SALc'></ul><sub id='6SALc'></sub></form><legend id='6SALc'></legend><bdo id='6SALc'><pre id='6SALc'><center id='6SALc'></center></pre></bdo></b><th id='6SALc'></th></span></q></dt></tr></i><div id='6SALc'><tfoot id='6SALc'></tfoot><dl id='6SALc'><fieldset id='6SALc'></fieldset></dl></div>

      1. <small id='6SALc'></small><noframes id='6SALc'>

          <bdo id='6SALc'></bdo><ul id='6SALc'></ul>

        Symfony Doctrine 找不到要加载的装置

        Symfony Doctrine can#39;t find fixtures to load(Symfony Doctrine 找不到要加载的装置)

        1. <legend id='N46og'><style id='N46og'><dir id='N46og'><q id='N46og'></q></dir></style></legend>

          <small id='N46og'></small><noframes id='N46og'>

            <tbody id='N46og'></tbody>
          • <bdo id='N46og'></bdo><ul id='N46og'></ul>

              <tfoot id='N46og'></tfoot>

              • <i id='N46og'><tr id='N46og'><dt id='N46og'><q id='N46og'><span id='N46og'><b id='N46og'><form id='N46og'><ins id='N46og'></ins><ul id='N46og'></ul><sub id='N46og'></sub></form><legend id='N46og'></legend><bdo id='N46og'><pre id='N46og'><center id='N46og'></center></pre></bdo></b><th id='N46og'></th></span></q></dt></tr></i><div id='N46og'><tfoot id='N46og'></tfoot><dl id='N46og'><fieldset id='N46og'></fieldset></dl></div>
                1. 本文介绍了Symfony Doctrine 找不到要加载的装置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我从 Symfony (3.4) 开始,但负载夹具有问题.
                  当我执行 php bin/console dictionary:fixtures:load 然后我得到消息:

                  <上一页>在 LoadDataFixturesDoctrineCommand.php 第 95 行:找不到要加载的任何固定装置服务.

                  这是我的代码:

                  ~/src/AppBundle/DataFixtures/ORM/LoadUserData.php

                  命名空间 AppBundleDataFixturesORM;使用 DoctrineCommonDataFixturesFixtureInterface;使用 DoctrineCommonPersistenceObjectManager;使用 SymfonyComponentDependencyInjectionContainerAwareInterface;使用 SymfonyComponentDependencyInjectionContainerInterface;类 LoadUserData 实现 FixtureInterface、ContainerAwareInterface {私人$容器;/*** 使用传递的 EntityManager 加载数据夹具** @param 对象管理器 $manager*/公共函数加载(ObjectManager $manager){$user = 新用户();$user->setLogin('admin');$user->setEmail('admin@admin.admin');$encoder = $this->container->get('security.password_encoder');$password = $encoder->encodePassword($user, '123qwe');$user->setPassword($password);$manager->persist();$manager->flush();}公共函数 setContainer(ContainerInterface $container = null){$this->container = $container;}}

                  ~/app/config/services.yml

                   参数:服务:_默认值:自动接线:真自动配置:真公开:假应用程序包:资源:'../../src/AppBundle/*'排除:'../../src/AppBundle/{Entity,Repository,Tests}'AppBundle控制器:资源:'../../src/AppBundle/Controller'公开:真实标签: ['controller.service_arguments']

                  谢谢.

                  解决方案

                  根据您使用的夹具版本,您应该扩展/实现不同的类.如果版本 >= 3.0 则

                  扩展 Fixture (使用 DoctrineBundleFixturesBundleFixture;)

                  如果

                  3.0

                  实现 FixtureInterface, ContainerAwareInterface

                  I starting with Symfony (3.4) and I have problem with load fixture.
                  When I execute php bin/console doctrine:fixtures:load then I get message:

                  In LoadDataFixturesDoctrineCommand.php line 95:
                    Could not find any fixture services to load.
                  

                  There is my code:

                  ~/src/AppBundle/DataFixtures/ORM/LoadUserData.php

                  namespace AppBundleDataFixturesORM;
                  
                  use DoctrineCommonDataFixturesFixtureInterface;
                  use DoctrineCommonPersistenceObjectManager;
                  use SymfonyComponentDependencyInjectionContainerAwareInterface;
                  use SymfonyComponentDependencyInjectionContainerInterface;
                  
                  class LoadUserData implements FixtureInterface, ContainerAwareInterface {
                  
                      private $container;
                  
                      /**
                       * Load data fixtures with the passed EntityManager
                       *
                       * @param ObjectManager $manager
                       */
                      public function load(ObjectManager $manager)
                      {
                          $user = new User();
                          $user->setLogin('admin');
                          $user->setEmail('admin@admin.admin');
                          $encoder = $this->container->get('security.password_encoder');
                          $password = $encoder->encodePassword($user, '123qwe');
                          $user->setPassword($password);
                  
                          $manager->persist();
                          $manager->flush();
                      }
                  
                      public function setContainer(ContainerInterface $container = null)
                      {
                          $this->container = $container;
                      }
                  }
                  

                  ~/app/config/services.yml

                      parameters:
                  
                      services:
                          _defaults:
                              autowire: true
                              autoconfigure: true
                              public: false
                  
                          AppBundle:
                              resource: '../../src/AppBundle/*'
                              exclude: '../../src/AppBundle/{Entity,Repository,Tests}'
                  
                          AppBundleController:
                              resource: '../../src/AppBundle/Controller'
                              public: true
                              tags: ['controller.service_arguments']
                  

                  Thanks.

                  解决方案

                  Depending on what version of fixtures you use you should extend/implement different classes. If the version is >= 3.0 then

                  extend Fixture (use DoctrineBundleFixturesBundleFixture;)
                  

                  If < 3.0

                  implements FixtureInterface, ContainerAwareInterface
                  

                  这篇关于Symfony Doctrine 找不到要加载的装置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                      <tbody id='ZiL56'></tbody>
                      <bdo id='ZiL56'></bdo><ul id='ZiL56'></ul>
                      <i id='ZiL56'><tr id='ZiL56'><dt id='ZiL56'><q id='ZiL56'><span id='ZiL56'><b id='ZiL56'><form id='ZiL56'><ins id='ZiL56'></ins><ul id='ZiL56'></ul><sub id='ZiL56'></sub></form><legend id='ZiL56'></legend><bdo id='ZiL56'><pre id='ZiL56'><center id='ZiL56'></center></pre></bdo></b><th id='ZiL56'></th></span></q></dt></tr></i><div id='ZiL56'><tfoot id='ZiL56'></tfoot><dl id='ZiL56'><fieldset id='ZiL56'></fieldset></dl></div>

                      <small id='ZiL56'></small><noframes id='ZiL56'>

                    • <tfoot id='ZiL56'></tfoot>

                        1. <legend id='ZiL56'><style id='ZiL56'><dir id='ZiL56'><q id='ZiL56'></q></dir></style></legend>