In my config file I've defined custom Entity Manager:
parameters:
doctrine.orm.entity_manager:
class: Strict\UserBundle\Entity\Manager\MyEntityManager
Is the a way to inject/add @session service (I need to get access to getLocale() method) into this entity manager? I've tried this:
parameters:
doctrine.orm.entity_manager:
class: Strict\UserBundle\Entity\Manager\MyEntityManager
arguments:
session: "@session"
but it throws this exception:
InvalidArgumentException: You cannot dump a container with parameters that contain references to other services (reference to service "session" found in "/doctrine.orm.entity_manager/arguments/session").
Any ideas?
Parameters don't allow services as arguments, have you tried doing the same thing but using a service:
service:
my.entity.manager:
class: Strict\UserBundle\Entity\Manager\MyEntityManager
arguments:
session: "@session"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With