diff --git a/core/lib/Drupal/Core/Entity/EntityTypeManager.php b/core/lib/Drupal/Core/Entity/EntityTypeManager.php index abe96a5..9115da2 100644 --- a/core/lib/Drupal/Core/Entity/EntityTypeManager.php +++ b/core/lib/Drupal/Core/Entity/EntityTypeManager.php @@ -6,6 +6,7 @@ use Drupal\Component\Plugin\Exception\PluginNotFoundException; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\DependencyInjection\ClassResolverInterface; +use Drupal\Core\Entity\Annotation\EntityType; use Drupal\Core\Entity\Exception\InvalidLinkTemplateException; use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Plugin\DefaultPluginManager; @@ -79,7 +80,6 @@ public function __construct(\Traversable $namespaces, ModuleHandlerInterface $mo $this->setCacheBackend($cache, 'entity_type', ['entity_types']); $this->alterInfo('entity_type'); - $this->discovery = new AnnotatedClassDiscovery('Entity', $namespaces, 'Drupal\Core\Entity\Annotation\EntityType'); $this->stringTranslation = $string_translation; $this->classResolver = $class_resolver; } @@ -87,6 +87,16 @@ public function __construct(\Traversable $namespaces, ModuleHandlerInterface $mo /** * {@inheritdoc} */ + protected function getDiscovery() { + if (!$this->discovery) { + $this->discovery = new AnnotatedClassDiscovery('Entity', $this->namespaces, EntityType::class); + } + return $this->discovery; + } + + /** + * {@inheritdoc} + */ public function processDefinition(&$definition, $plugin_id) { /** @var \Drupal\Core\Entity\EntityTypeInterface $definition */ parent::processDefinition($definition, $plugin_id);