相关疑难解决方法(0)

How to inject non-default entity managers?

In Symfony2 you can work with multiple entity managers and use something like the code below:

$em = $this->get('doctrine')->getManager();
$em = $this->get('doctrine')->getManager('default');

$customerEm =  $this->get('doctrine')->getManager('customer');
Run Code Online (Sandbox Code Playgroud)

We can inject the default manager to any service by using:

"@doctrine.orm.entity_manager"
Run Code Online (Sandbox Code Playgroud)

How can you inject non-default entity managers into services?

symfony doctrine-orm symfony-2.1

12
推荐指数
2
解决办法
8910
查看次数

标签 统计

doctrine-orm ×1

symfony ×1

symfony-2.1 ×1