/** * @param array $paths * @return \Doctrine\ORM\Mapping\Driver\AnnotationDriver */ protected function createAnnotationDriver($paths = array(), $alias = null) { if (version_compare(\Doctrine\Common\Version::VERSION, '3.0.0', '>=')) { $reader = new \Doctrine\Common\Annotations\CachedReader(new \Doctrine\Common\Annotations\AnnotationReader(), new ArrayCache()); } else { if (version_compare(\Doctrine\Common\Version::VERSION, '2.2.0-DEV', '>=')) { // Register the ORM Annotations in the AnnotationRegistry $reader = new \Doctrine\Common\Annotations\SimpleAnnotationReader(); $reader->addNamespace('Doctrine\\ORM\\Mapping'); $reader = new \Doctrine\Common\Annotations\CachedReader($reader, new ArrayCache()); } else { if (version_compare(\Doctrine\Common\Version::VERSION, '2.1.0-BETA3-DEV', '>=')) { $reader = new \Doctrine\Common\Annotations\AnnotationReader(); $reader->setIgnoreNotImportedAnnotations(true); $reader->setEnableParsePhpImports(false); if ($alias) { $reader->setAnnotationNamespaceAlias('Doctrine\\ORM\\Mapping\\', $alias); } else { $reader->setDefaultAnnotationNamespace('Doctrine\\ORM\\Mapping\\'); } $reader = new \Doctrine\Common\Annotations\CachedReader(new \Doctrine\Common\Annotations\IndexedReader($reader), new ArrayCache()); } else { $reader = new \Doctrine\Common\Annotations\AnnotationReader(); if ($alias) { $reader->setAnnotationNamespaceAlias('Doctrine\\ORM\\Mapping\\', $alias); } else { $reader->setDefaultAnnotationNamespace('Doctrine\\ORM\\Mapping\\'); } } } } \Doctrine\Common\Annotations\AnnotationRegistry::registerFile(__DIR__ . "/../../../lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php"); return new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, (array) $paths); }
/** * @param array $paths * @return \Doctrine\Common\Annotations\AnnotationReader */ protected function createAnnotationDriver($paths = array(), $alias = null) { if (version_compare(\Doctrine\Common\Version::VERSION, '3.0.0', '>=')) { $reader = new \Doctrine\Common\Annotations\CachedReader(new \Doctrine\Common\Annotations\AnnotationReader(), new ArrayCache()); } else { if (version_compare(\Doctrine\Common\Version::VERSION, '2.1.0-BETA3-DEV', '>=')) { $reader = new \Doctrine\Common\Annotations\AnnotationReader(); $reader->setIgnoreNotImportedAnnotations(true); $reader->setEnableParsePhpImports(false); if ($alias) { $reader->setAnnotationNamespaceAlias('Doctrine\\ORM\\Mapping\\', $alias); } else { $reader->setDefaultAnnotationNamespace('Doctrine\\ORM\\Mapping\\'); } $reader = new \Doctrine\Common\Annotations\CachedReader(new \Doctrine\Common\Annotations\IndexedReader($reader), new ArrayCache()); } else { $reader = new \Doctrine\Common\Annotations\AnnotationReader(); if ($alias) { $reader->setAnnotationNamespaceAlias('Doctrine\\ORM\\Mapping\\', $alias); } else { $reader->setDefaultAnnotationNamespace('Doctrine\\ORM\\Mapping\\'); } } } return new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($reader, (array) $paths); }
/** * Create default annotation reader for extensions * * @return \Doctrine\Common\Annotations\AnnotationReader */ private function getDefaultAnnotationReader() { if (null === self::$defaultAnnotationReader) { if (version_compare(\Doctrine\Common\Version::VERSION, '2.2.0-DEV', '>=')) { $reader = new \Doctrine\Common\Annotations\AnnotationReader(); \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace('Gedmo\\Mapping\\Annotation', __DIR__ . '/../../'); $reader = new \Doctrine\Common\Annotations\CachedReader($reader, new ArrayCache()); } elseif (version_compare(\Doctrine\Common\Version::VERSION, '2.1.0RC4-DEV', '>=')) { $reader = new \Doctrine\Common\Annotations\AnnotationReader(); \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace('Gedmo\\Mapping\\Annotation', __DIR__ . '/../../'); $reader->setDefaultAnnotationNamespace('Doctrine\\ORM\\Mapping\\'); $reader = new \Doctrine\Common\Annotations\CachedReader($reader, new ArrayCache()); } elseif (version_compare(\Doctrine\Common\Version::VERSION, '2.1.0-BETA3-DEV', '>=')) { $reader = new \Doctrine\Common\Annotations\AnnotationReader(); $reader->setDefaultAnnotationNamespace('Doctrine\\ORM\\Mapping\\'); $reader->setIgnoreNotImportedAnnotations(true); $reader->setAnnotationNamespaceAlias('Gedmo\\Mapping\\Annotation\\', 'gedmo'); $reader->setEnableParsePhpImports(false); $reader->setAutoloadAnnotations(true); $reader = new \Doctrine\Common\Annotations\CachedReader(new \Doctrine\Common\Annotations\IndexedReader($reader), new ArrayCache()); } else { $reader = new \Doctrine\Common\Annotations\AnnotationReader(); $reader->setAutoloadAnnotations(true); $reader->setAnnotationNamespaceAlias('Gedmo\\Mapping\\Annotation\\', 'gedmo'); $reader->setDefaultAnnotationNamespace('Doctrine\\ORM\\Mapping\\'); } self::$defaultAnnotationReader = $reader; } return self::$defaultAnnotationReader; }