소스 검색

added doctrine common v3.0 version check per https://github.com/l3pp4rd/DoctrineExtensions/pull/126/files#r78656

Mathias Verraes 14 년 전
부모
커밋
7eff3f232e
1개의 변경된 파일8개의 추가작업 그리고 1개의 파일을 삭제
  1. 8 1
      lib/Gedmo/Mapping/MappedEventSubscriber.php

+ 8 - 1
lib/Gedmo/Mapping/MappedEventSubscriber.php

@@ -194,7 +194,14 @@ abstract class MappedEventSubscriber implements EventSubscriber
     private function getDefaultAnnotationReader()
     {
         if (null === $this->defaultAnnotationReader) {
-            if (version_compare(\Doctrine\Common\Version::VERSION, '2.1.0RC4-DEV', '>=')) {
+            if (version_compare(\Doctrine\Common\Version::VERSION, '3.0.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());
+            } else if (version_compare(\Doctrine\Common\Version::VERSION, '2.1.0RC4-DEV', '>=')) {
                 $reader = new \Doctrine\Common\Annotations\AnnotationReader();
                 \Doctrine\Common\Annotations\AnnotationRegistry::registerAutoloadNamespace(
                     'Gedmo\\Mapping\\Annotation',