public function lookup($lookupName)
{
// query whether the entity manager has been registered or not
if (isset($this->entityManagers[$lookupName])) {
// load the entity manager configuration
$persistenceUnitNode = $this->entityManagers[$lookupName];
// load the factory class from the configuration
$factoryClass = $persistenceUnitNode->getFactory();
// create a new entity manager instance from the configuration
return $factoryClass::factory($this->getApplication(), $persistenceUnitNode);
}
// throw an exception if the requested entity manager has not been registered
throw new EntityManagerLookupException(sprintf('Entity Manager with lookup name %s has not been registered in application %s', $lookupName, $this->getApplication()->getName()));
}