/** * Initialize the entity manager using the provided configuration. * Configuration options are detailed in the Configuration class. * * @param Configuration|array $configuration Various information about how the entity manager should behave. * @throws Exception */ public function __construct($configuration = null) { if (is_null($configuration)) { $configuration = new Configuration(); } elseif (is_array($configuration)) { $configuration = new Configuration($configuration); } elseif (!$configuration instanceof Configuration) { throw new Exception('Provided argument must be a Configuration object or an array.'); } $this->proxyFactory = $configuration->getProxyFactory(); $this->client = $configuration->getClient(); $this->metaRepository = $configuration->getMetaRepository(); $this->dateGenerator = function () { $currentDate = new \DateTime(); return $currentDate->format('Y-m-d H:i:s'); }; $this->pathFinder = new PathFinder\PathFinder(); $this->pathFinder->setEntityManager($this); $configuration->configurePathFinder($this->pathFinder); }
function testSpecifyAnnotationReader() { $reader = new \Doctrine\Common\Annotations\CachedReader(new \Doctrine\Common\Annotations\AnnotationReader(), new \Doctrine\Common\Cache\ArrayCache()); $configuration = new Configuration(array('annotation_reader' => $reader)); $this->assertEquals(new Repository($reader), $configuration->getMetaRepository()); }