youshido-php/GraphQLBundle

Use multiple Entity Managers and Connections

Opened this issue · 1 comments

I have multiple Entity Managers and Connections in my Symfony project and all is OK
https://symfony.com/doc/current/doctrine/multiple_entity_managers.html

Now I would like to use multiple Entity Managers in my resolvers or fields but I do not know how to do.

Thanks

If this can help you, in my services.yml

I create new em
em_other: class: Doctrine\ORM\EntityManager factory: ['@doctrine', 'getManager'] arguments: ["other"]

and new resolver base
resolver.other: class: AppBundle\Resolver\AbstractResolver abstract: true calls: [ init, ['@em_other']]

and edit parent of resolver
resolver.customers: class: AppBundle\Resolver\WstiersResolver parent: 'resolver.other'