Transfer Entity Entity Manager to the service

I want to pass Entity Manager to Doctrine so that I can access my repositories, etc., but I'm having problems.

Defined by my service:

mlbp_beer.rest.controller: class: MLBP\BeerBundle\Controller\RestController arguments: em: "@doctrine.orm.entity_manager" 

This gives me an error:

 ParameterNotFoundException: The service "mlbp_beer.rest.controller" has a dependency on a non-existent parameter "doctrine.orm.entity_manager". 

Thanks for the help!

+6
source share
1 answer

What looks right? Make sure the rest is defined in your routing.yml, and so .. Clear the cache too!

 rest: resource: mlbp_beer.rest.controller type: rest 
+3
source

Source: https://habr.com/ru/post/902814/


All Articles