function FieldableEntityNormalizerTrait::getEntityTypeManager

Same name and namespace in other branches
  1. 9 core/modules/serialization/src/Normalizer/FieldableEntityNormalizerTrait.php \Drupal\serialization\Normalizer\FieldableEntityNormalizerTrait::getEntityTypeManager()
  2. 10 core/modules/serialization/src/Normalizer/FieldableEntityNormalizerTrait.php \Drupal\serialization\Normalizer\FieldableEntityNormalizerTrait::getEntityTypeManager()
  3. 11.x core/modules/serialization/src/Normalizer/FieldableEntityNormalizerTrait.php \Drupal\serialization\Normalizer\FieldableEntityNormalizerTrait::getEntityTypeManager()

Returns the entity type manager.

Return value

\Drupal\Core\Entity\EntityTypeManagerInterface The entity type manager.

File

core/modules/serialization/src/Normalizer/FieldableEntityNormalizerTrait.php, line 190

Class

FieldableEntityNormalizerTrait
A trait for providing fieldable entity normalization/denormalization methods.

Namespace

Drupal\serialization\Normalizer

Code

protected function getEntityTypeManager() {
    if (!$this->entityTypeManager) {
        @trigger_error('The entityTypeManager property must be set on the FieldEntityNormalizerTrait, it is required before Drupal 9.0.0. See https://www.drupal.org/node/2549139.', E_USER_DEPRECATED);
        $this->entityTypeManager = \Drupal::service('entity_type.manager');
    }
    return $this->entityTypeManager;
}

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