public function createManager($storage = null) { $cache = new ArrayCache(); $storage = $storage ?: new DoctrineCacheStorage($cache); $reader = new \Doctrine\Common\Annotations\AnnotationReader(); $metadata = new AnnotationDriver($reader); $config = new Configuration(); $config->setMappingDriverImpl($metadata); $config->setMetadataCache($cache); return new EntityManager($storage, $config); }
public function createManager($storage = null, $driver = 'annotation') { $cache = new ArrayCache(); $storage = $storage ?: new DoctrineCacheStorage($cache); switch ($driver) { case 'annotation': $reader = new \Doctrine\Common\Annotations\AnnotationReader(); $metadata = new Mapping\AnnotationDriver($reader); break; case 'yaml': $metadata = new Mapping\YamlDriver(__DIR__ . '/fixtures/yaml'); break; case 'xml': $metadata = new Mapping\XmlDriver(__DIR__ . '/fixtures/xml'); break; } $config = new Configuration(); $config->setMappingDriverImpl($metadata); $config->setMetadataCache($cache); return new EntityManager($storage, $config); }