Explorar o código

[mapping] made default annotation reader static to share through listeners, closes #191

gediminasm %!s(int64=13) %!d(string=hai) anos
pai
achega
42ea82bdca
Modificáronse 1 ficheiros con 4 adicións e 4 borrados
  1. 4 4
      lib/Gedmo/Mapping/MappedEventSubscriber.php

+ 4 - 4
lib/Gedmo/Mapping/MappedEventSubscriber.php

@@ -61,7 +61,7 @@ abstract class MappedEventSubscriber implements EventSubscriber
     /**
      * @var \Doctrine\Common\Annotations\AnnotationReader
      */
-    private $defaultAnnotationReader;
+    private static $defaultAnnotationReader;
 
     /**
      * Get an event adapter to handle event specific
@@ -193,7 +193,7 @@ abstract class MappedEventSubscriber implements EventSubscriber
      */
     private function getDefaultAnnotationReader()
     {
-        if (null === $this->defaultAnnotationReader) {
+        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(
@@ -225,8 +225,8 @@ abstract class MappedEventSubscriber implements EventSubscriber
                 $reader->setAnnotationNamespaceAlias('Gedmo\\Mapping\\Annotation\\', 'gedmo');
                 $reader->setDefaultAnnotationNamespace('Doctrine\ORM\Mapping\\');
             }
-            $this->defaultAnnotationReader = $reader;
+            self::$defaultAnnotationReader = $reader;
         }
-        return $this->defaultAnnotationReader;
+        return self::$defaultAnnotationReader;
     }
 }