You are here

public function EntityReferenceItemNormalizer::__construct in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php \Drupal\hal\Normalizer\EntityReferenceItemNormalizer::__construct()

Constructs an EntityReferenceItemNormalizer object.

Parameters

\Drupal\hal\LinkManager\LinkManagerInterface $link_manager: The hypermedia link manager.

\Drupal\serialization\EntityResolver\EntityResolverInterface $entity_Resolver: The entity resolver.

\Drupal\Core\Entity\EntityTypeManagerInterface|null $entity_type_manager: The entity type manager.

File

core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php, line 57

Class

EntityReferenceItemNormalizer
Converts the Drupal entity reference item object to HAL array structure.

Namespace

Drupal\hal\Normalizer

Code

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 ?: \Drupal::service('entity_type.manager');
}