zf2 doctrine2 and Zend\\Db\\Adapter\\Adapter using one db connection
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I use doctrine2 with ZF2, some of my libraries work with Zend\Db\Adapter\Adapter, others with doctrine2. Now, they connect to database twice. Is it possible to use one db connection in doctrine and standard ZF2 db adapter? 回答1: The DoctrineORM module accepts a PDO resource or a service name where the instance can be located in the service manager instead of the usual connection params. First step is to create a service factory which retrieves the PDO resource from the Zend\Db\Adapter\Adapter service <? php namespace Application \Db