public function getEntityManager($emName = null)
{
$emName = $emName ?: $this->defaultEntityManager;
// Check if ORM Entity Manager has not yet been initialized
if (!isset($this->entityManagers[$emName])) {
// Check if ORM EntityManager is configured
if (!isset($this->configuration['orm'][$emName])) {
throw new Exception\NameNotFoundException("Unable to find Doctrine ORM EntityManager '{$emName}'.");
}
$this->entityManagers[$emName] = $this->startORMEntityManager($this->configuration['orm'][$emName]);
unset($this->configuration['orm'][$emName]);
}
return $this->entityManagers[$emName];
}