/**
* Creates a new XmlEntityManager that uses the given Configuration and EventManager implementations.
*
* @param Storage $storage
* @param Configuration $config
* @param \Doctrine\Common\EventManager $eventManager
*/
public function __construct(Storage $storage, Configuration $config, EventManager $eventManager = null)
{
$this->storage = $storage;
$this->config = $config;
if (null === $eventManager) {
$eventManager = new EventManager();
}
$this->eventManager = $eventManager;
$metadataFactoryClassName = $config->getClassMetadataFactoryName();
$this->metadataFactory = new $metadataFactoryClassName($config, $this->eventManager);
$this->metadataFactory->setCacheDriver($this->config->getMetadataCacheImpl());
$marshallerClassName = $config->getMarshallerClassName();
$this->marshaller = new $marshallerClassName($this->metadataFactory);
$this->unitOfWork = new UnitOfWork($this);
}