function ContentEntityNormalizer::__construct

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

Constructs an ContentEntityNormalizer object.

Parameters

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

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

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler.

\Drupal\Core\Entity\EntityTypeRepositoryInterface $entity_type_repository: The entity type repository.

\Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager: The entity field manager.

1 call to ContentEntityNormalizer::__construct()
FileEntityNormalizer::__construct in core/modules/hal/src/Normalizer/FileEntityNormalizer.php
Constructs a FileEntityNormalizer object.
1 method overrides ContentEntityNormalizer::__construct()
FileEntityNormalizer::__construct in core/modules/hal/src/Normalizer/FileEntityNormalizer.php
Constructs a FileEntityNormalizer object.

File

core/modules/hal/src/Normalizer/ContentEntityNormalizer.php, line 64

Class

ContentEntityNormalizer
Converts the Drupal entity object structure to a HAL array structure.

Namespace

Drupal\hal\Normalizer

Code

public function __construct(LinkManagerInterface $link_manager, EntityTypeManagerInterface $entity_type_manager, ModuleHandlerInterface $module_handler, EntityTypeRepositoryInterface $entity_type_repository = NULL, EntityFieldManagerInterface $entity_field_manager = NULL) {
    $this->linkManager = $link_manager;
    $this->entityTypeManager = $entity_type_manager;
    $this->moduleHandler = $module_handler;
    $this->entityTypeRepository = $entity_type_repository;
    if (!$entity_type_repository) {
        @trigger_error('The entity_type.repository service must be passed to ContentEntityNormalizer::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
        $entity_type_repository = \Drupal::service('entity_type.repository');
    }
    $this->entityTypeRepository = $entity_type_repository;
    if (!$entity_field_manager) {
        @trigger_error('The entity_field.manager service must be passed to ContentEntityNormalizer::__construct(), it is required before Drupal 9.0.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
        $entity_field_manager = \Drupal::service('entity_field.manager');
    }
    $this->entityFieldManager = $entity_field_manager;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.