Author: Tamás Millián (tamas.millian@gmail.com)
Ejemplo n.º 1
0
 /**
  * Instatiates a new Mapper, injecting the $mapper that will be used to
  * hydrate record retrieved through the $binding.
  *
  * @param BindingInterface $binding
  * @param Configuration $configuration
  */
 public function __construct(BindingInterface $binding, Configuration $configuration)
 {
     $this->configuration = $configuration;
     $this->binding = $binding;
     $this->inflector = $configuration->getInflector();
     $this->metadataFactory = $configuration->getMetadataFactory();
     $this->cache = $configuration->getCache();
     $this->uow = new UnitOfWork($this);
     /**
      * this must be the last since it will require the Manager to be constructed already.
      * TODO fixthis
      */
     $this->proxyFactory = new ProxyFactory($this, $configuration->getProxyDirectory(), $configuration->getProxyNamespace(), $configuration->getAutoGenerateProxyClasses());
 }
Ejemplo n.º 2
0
 /**
  * Instantiates a new DocumentMapper, injecting the $mapper that will be used to
  * hydrate record retrieved through the $binding.
  *
  * @param BindingInterface  $binding
  * @param Configuration     $configuration
  * @param EventManager|null $eventManager
  *
  * @throws ConfigurationException
  */
 public function __construct(BindingInterface $binding, Configuration $configuration, EventManager $eventManager = null)
 {
     $this->binding = $binding;
     $this->configuration = $configuration;
     $this->eventManager = $eventManager ?: new EventManager();
     $metadataFactoryClassName = $this->configuration->getClassMetadataFactoryName();
     $this->metadataFactory = new $metadataFactoryClassName();
     $this->metadataFactory->setDocumentManager($this);
     $this->metadataFactory->setConfiguration($this->configuration);
     $this->metadataFactory->setCacheDriver($this->configuration->getMetadataCacheImpl());
     if (!($hf = $this->configuration->getHydratorFactoryImpl())) {
         $hf = new DynamicHydratorFactory();
     }
     $this->hydratorFactory = $hf;
     $hf->setDocumentManager($this);
     $this->clusterMap = new ClusterMap($this->binding, $this->configuration->getMetadataCacheImpl());
     $this->uow = new UnitOfWork($this, $this->eventManager, $this->hydratorFactory);
     $this->proxyFactory = new ProxyFactory($this, $configuration->getProxyDirectory(), $configuration->getProxyNamespace(), $configuration->getAutoGenerateProxyClasses());
 }