function ResourceObjectNormalizer::__construct

Same name in other branches
  1. 9 core/modules/jsonapi/src/Normalizer/ResourceObjectNormalizer.php \Drupal\jsonapi\Normalizer\ResourceObjectNormalizer::__construct()
  2. 8.9.x core/modules/jsonapi/src/Normalizer/ResourceObjectNormalizer.php \Drupal\jsonapi\Normalizer\ResourceObjectNormalizer::__construct()
  3. 10 core/modules/jsonapi/src/Normalizer/ResourceObjectNormalizer.php \Drupal\jsonapi\Normalizer\ResourceObjectNormalizer::__construct()

Constructs a ResourceObjectNormalizer object.

Parameters

\Drupal\jsonapi\EventSubscriber\ResourceObjectNormalizationCacher $cacher: The entity normalization cacher.

\Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher: The event dispatcher.

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

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

File

core/modules/jsonapi/src/Normalizer/ResourceObjectNormalizer.php, line 72

Class

ResourceObjectNormalizer
Converts the JSON:API module ResourceObject into a JSON:API array structure.

Namespace

Drupal\jsonapi\Normalizer

Code

public function __construct(ResourceObjectNormalizationCacher $cacher, ?EventDispatcherInterface $event_dispatcher = NULL, ?EntityFieldManagerInterface $entity_field_manager = NULL, ?EntityTypeManagerInterface $entity_type_manager = NULL) {
    $this->cacher = $cacher;
    if ($event_dispatcher === NULL) {
        @trigger_error('Calling ' . __METHOD__ . '() without the $event_dispatcher argument is deprecated in drupal:11.2.0 and will be required in drupal:12.0.0. See https://www.drupal.org/node/3280569', E_USER_DEPRECATED);
        $event_dispatcher = \Drupal::service('event_dispatcher');
    }
    $this->eventDispatcher = $event_dispatcher;
    if ($entity_field_manager === NULL) {
        @trigger_error('Calling ' . __METHOD__ . '() without the $entity_field_manager argument is deprecated in drupal:11.2.0 and will be required in drupal:12.0.0. See https://www.drupal.org/node/3031367', E_USER_DEPRECATED);
        $entity_field_manager = \Drupal::service('entity_field_manager');
    }
    $this->entityFieldManager = $entity_field_manager;
    if ($entity_type_manager === NULL) {
        @trigger_error('Calling ' . __METHOD__ . '() without the $entity_type_manager argument is deprecated in drupal:11.2.0 and will be required in drupal:12.0.0. See https://www.drupal.org/node/3031367', E_USER_DEPRECATED);
        $entity_type_manager = \Drupal::service('entity_type_manager');
    }
    $this->entityTypeManager = $entity_type_manager;
}

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