symfony/symfony-docs — pull request #3545 by colinodell (2014-02-05 22:26:17+00:00)
Title: Example of getting entity managers directly from the container

The documentation didn't provide examples of how to obtain the entity managers directly from the DI container. This is useful when needing to inject the em into other services.

The ems are added to the container using the service id `doctrine.orm.%s_entity_manager`, where `%s` is the em's name. This is done by [`\Doctrine\Bundle\DoctrineBundle\DependencyInjection\DoctrineExtension::loadOrmEntityManager()`](https://github.com/doctrine/DoctrineBundle/blob/v1.2.0/DependencyInjection/DoctrineExtension.php#L347)