【问题标题】:"Missing Service" When declare new Topic in Symfony在 Symfony 中声明新主题时“缺少服务”
【发布时间】:2018-04-08 18:47:09
【问题描述】:

我正在我的应用上实现套接字,所以我执行了以下步骤:

  1. 创建主题处理程序服务,例如 this,但在其 __construct 方法上使用实体管理器。

    public function __construct(EntityManager $em, ClientManipulatorInterface $client) {
        $this->em = $em;
        $this->client = $client;
    }
    
  2. 向 symfony 注册你的服务。

    2.1。文件services.yml 如下所示:

    foo.topic: 
        class: AppBundle\Topic\FooTopic
        arguments:["@doctrine.orm.personem_entity_manager", "@gos_web_socket.websocket.client_manipulator"]
        tags:
          -{ name: gos_web_socket.topic}
    

    here 是当我在传递的第一个参数中收到错误 Missing service 时。 我找不到我的实体管理器,但我已在我的 conf 文件中声明它。

    personem:
        dql:
          string_functions:
            convert: AppBundle\Dql\ConvertFunction
        connection: connection
        mappings:
          GptIReunionBundle: ~
          AppBundle: ~
    

有什么想法吗?

【问题讨论】:

    标签: php symfony entitymanager symfony-3.3 phpwebsocket


    【解决方案1】:

    问题是,我在 local 环境中使用service.yml 并且我没有在我的config_prod.yml 文件中声明实体管理器。

    所以我解决了在所有环境中创建实体管理器的问题。

    【讨论】:

      猜你喜欢
      • 2018-02-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多