浏览代码

Merge pull request #126 from mathiasverraes/patch-1

fixes issue when using default doctrine configuration
Gediminas Morkevicius 14 年之前
父节点
当前提交
07ad426012
共有 1 个文件被更改,包括 9 次插入1 次删除
  1. 9 1
      lib/Gedmo/Mapping/MappedEventSubscriber.php

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

@@ -194,13 +194,21 @@ 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',
+                    __DIR__ . '/../../'
+                );
+                $reader->setDefaultAnnotationNamespace('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->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');