Doctrine\OXM\XmlEntityManager::__construct PHP Method

__construct() public method

Creates a new XmlEntityManager that uses the given Configuration and EventManager implementations.
public __construct ( Doctrine\OXM\Storage\Storage $storage, Configuration $config, Doctrine\Common\EventManager $eventManager = null )
$storage Doctrine\OXM\Storage\Storage
$config Configuration
$eventManager Doctrine\Common\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);
        $this->proxyFactory = new ProxyFactory($this, $this->config->getProxyDir(), $this->config->getProxyNamespace(), $this->config->getAutoGenerateProxyClasses());
    }