💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
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; } ~~~