diff --git a/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php b/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php index ddc8644..5648b0d 100644 --- a/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php +++ b/core/lib/Drupal/Component/Plugin/Discovery/AnnotatedClassDiscovery.php @@ -7,7 +7,6 @@ namespace Drupal\Component\Plugin\Discovery; -use Doctrine\Common\Annotations\AnnotationReader; use Doctrine\Common\Annotations\SimpleAnnotationReader; use Drupal\Component\Reflection\MockFileFinder; use Doctrine\Common\Annotations\AnnotationRegistry; @@ -65,7 +64,11 @@ function __construct($plugin_namespaces = array(), $plugin_definition_annotation */ protected function getAnnotationReader() { if (!isset($this->annotationReader)) { - $this->annotationReader = new AnnotationReader(); + $this->annotationReader = new SimpleAnnotationReader(); + + // Add the namespaces from the main plugin annotation, like @EntityType. + $namespace = substr($this->pluginDefinitionAnnotationName, 0, strrpos($this->pluginDefinitionAnnotationName, '\\')); + $this->annotationReader->addNamespace($namespace); } return $this->annotationReader; } diff --git a/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php index e05007b..b66118b 100644 --- a/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php +++ b/core/lib/Drupal/Core/Plugin/Discovery/AnnotatedClassDiscovery.php @@ -7,7 +7,6 @@ namespace Drupal\Core\Plugin\Discovery; -use Doctrine\Common\Annotations\SimpleAnnotationReader; use Drupal\Component\Plugin\Discovery\AnnotatedClassDiscovery as ComponentAnnotatedClassDiscovery; /** @@ -60,14 +59,11 @@ function __construct($subdir, \Traversable $root_namespaces, $plugin_definition_ */ protected function getAnnotationReader() { if (!isset($this->annotationReader)) { - $this->annotationReader = new SimpleAnnotationReader(); + $reader = parent::getAnnotationReader(); // Add the Core annotation classes like @Translation. - $this->annotationReader->addNamespace('Drupal\Core\Annotation', array(DRUPAL_ROOT . '/core/lib/Drupal/Core/Annotation')); - - // Add the namespaces from the main plugin annotation, like @EntityType. - $namespace = substr($this->pluginDefinitionAnnotationName, 0, strrpos($this->pluginDefinitionAnnotationName, '\\')); - $this->annotationReader->addNamespace($namespace); + $reader->addNamespace('Drupal\Core\Annotation', array(DRUPAL_ROOT . '/core/lib/Drupal/Core/Annotation')); + $this->annotationReader = $reader; } return $this->annotationReader; }