Exemplo n.º 1
0
 /**
  * EntityManager constructor.
  *
  * @param Configuration $configuration
  */
 public function __construct(Configuration $configuration)
 {
     $this->configuration = $configuration;
     $this->metadataFactory = $configuration->getMetadataFactory();
     $this->metadataFactory->setEntityManager($this);
     $this->unitOfWork = new UnitOfWork($this);
     $this->proxyFactory = new ProxyFactory($this);
     if (null !== ($cache = $this->configuration->getApiCache())) {
         $this->entityCache = new ApiEntityCache($this, $cache, $this->configuration->getApiCacheLogger());
     }
 }
 /**
  * @return Configuration
  */
 protected function createConfiguration()
 {
     $configuration = new Configuration();
     $configuration->setMetadataFactory(new EntityMetadataFactory());
     $configuration->setRegistry($this->registry);
     $configuration->setTypeRegistry(new BaseTypeRegistry(new TypeRegistry()));
     $configuration->setProxyDir(CACHE_DIR . '/doctrine/proxy/');
     $configuration->setProxyNamespace('Bankiru\\Api\\Test\\Proxy');
     $driver = new MappingDriverChain();
     $driver->addDriver(new YmlMetadataDriver(new SymfonyFileLocator([__DIR__ . '/../Test/Resources/config/api/' => 'Bankiru\\Api\\Test\\Entity'], '.api.yml', DIRECTORY_SEPARATOR)), 'Bankiru\\Api\\Test\\Entity');
     $configuration->setDriver($driver);
     return $configuration;
 }