function FieldableEntityNormalizerTrait::getEntityTypeRepository

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

Returns the entity type repository.

Return value

\Drupal\Core\Entity\EntityTypeRepositoryInterface The entity type repository.

File

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

Class

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

Namespace

Drupal\serialization\Normalizer

Code

protected function getEntityTypeRepository() {
    if (!$this->entityTypeRepository) {
        @trigger_error('The entityTypeRepository 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->entityTypeRepository = \Drupal::service('entity_type.repository');
    }
    return $this->entityTypeRepository;
}

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