合规国际互联网加速 OSASE为企业客户提供高速稳定SD-WAN国际加速解决方案。 广告
1、Controller类中调用 ~~~ $em = $this->getDoctrine()->getManager(); ~~~ ~~~ $em = $this->getEntityManager(); ~~~ ~~~ $em = $this->get("doctrine.orm.entity_manager"); ~~~ 2、非Controller类中调用 ~~~ services: service_id: class: ××× calls: - { entityManager, [ @doctrine.orm.entity_manager ] } ~~~ ~~~ private $em; public function entityManager($entityManager){ $this->em = $entityManager; } ~~~