Skip to content

Commit 9a80b1b

Browse files
noniagriconomiejaviereguiluz
authored andcommitted
Update multiple_entity_managers.rst
1 parent 294a08d commit 9a80b1b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

doctrine/multiple_entity_managers.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,17 @@ the default entity manager (i.e. ``default``) is returned::
254254
}
255255
}
256256

257+
You can leverage the service binding feature to reference the ``customer``
258+
entity manager so that you can inject it directly::
259+
260+
services:
261+
_defaults:
262+
bind:
263+
$customerEntityManager: '@doctrine.orm.customer_entity_manager'
264+
265+
Now type-hint your method with ``EntityManagerInterface $customerEntityManager``
266+
to inject this second entity manager as dependency.
267+
257268
You can now use Doctrine like you did before - using the ``default`` entity
258269
manager to persist and fetch entities that it manages and the ``customer``
259270
entity manager to persist and fetch its entities.

0 commit comments

Comments
 (0)