.../src/Normalizer/EntityReferenceItemNormalizer.php | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php b/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php index d103894..324e7f9 100644 --- a/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php +++ b/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php @@ -55,7 +55,7 @@ class EntityReferenceItemNormalizer extends FieldItemNormalizer implements UuidR public function __construct(LinkManagerInterface $link_manager, EntityResolverInterface $entity_Resolver, EntityTypeManagerInterface $entity_type_manager = NULL) { $this->linkManager = $link_manager; $this->entityResolver = $entity_Resolver; - $this->entityTypeManager = $entity_type_manager; + $this->entityTypeManager = $entity_type_manager ?: \Drupal::service('entity_type.manager'); } /** @@ -130,7 +130,7 @@ protected function targetEntityIsFieldable(EntityReferenceItem $item) { } // Otherwise, we need to get the class for the type. - $target_entity_type = $this->getEntityTypeManager()->getDefinition($target_entity_type_id); + $target_entity_type = $this->entityTypeManager->getDefinition($target_entity_type_id); $target_entity_type_class = $target_entity_type->getClass(); return is_a($target_entity_type_class, FieldableEntityInterface::class, TRUE); @@ -164,19 +164,4 @@ public function getUuid($data) { } } - /** - * Gets the entity type manager. - * - * @return \Drupal\Core\Entity\EntityTypeManagerInterface|mixed - * - * @internal - * @todo Remove in Drupal 9.0.0. Only exists to provide constructor BC. - */ - protected function getEntityTypeManager() { - if (!isset($this->entityTypeManager)) { - $this->entityTypeManager = \Drupal::service('entity_type.manager'); - } - return $this->entityTypeManager; - } - }