Reputation: 1490
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?
Upvotes: 5
Views: 9073
Reputation: 638
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"
Upvotes: 16