在我的配置文件中,我定义了自定义实体管理器:
parameters:
doctrine.orm.entity_manager:
class: Strict\UserBundle\Entity\Manager\MyEntityManager
是否可以将@session 服务(我需要访问 getLocale() 方法)注入/添加到此实体管理器中?我试过这个:
parameters:
doctrine.orm.entity_manager:
class: Strict\UserBundle\Entity\Manager\MyEntityManager
arguments:
session: "@session"
但它抛出了这个异常:
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").
有任何想法吗?