Search code examples
phpsymfonyentitymanagersymfony-3.3phpwebsocket

"Missing Service" When declare new Topic in Symfony


I'm implementing sockets on my app, so I did these steps:

  1. Create the topic handler service, like this but with an Entity Manager on his __construct method.

    public function __construct(EntityManager $em, ClientManipulatorInterface $client) {
        $this->em = $em;
        $this->client = $client;
    }
    
  2. Register your service with symfony.

    2.1. The file services.yml looks like this:

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

    And here is when i get the error Missing service in the first argument passed. I can not found my Entity Manager but i have declared it in my conf file.

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

Any ideas?


Solution

  • The problem was, that im using service.yml when im in local enviroment and im not declared Entity Manager in my config_prod.yml file.

    So i solved creating the entity manager in all enviroments.