function Importer::loadEntityDependency

Same name in other branches
  1. 11.x core/lib/Drupal/Core/DefaultContent/Importer.php \Drupal\Core\DefaultContent\Importer::loadEntityDependency()

Loads the entity dependency by its UUID.

Parameters

string $target_uuid: The entity UUID.

Return value

\Drupal\Core\Entity\ContentEntityInterface|null The loaded entity.

1 call to Importer::loadEntityDependency()
Importer::setFieldValues in core/lib/Drupal/Core/DefaultContent/Importer.php
Sets field values based on the normalized data.

File

core/lib/Drupal/Core/DefaultContent/Importer.php, line 328

Class

Importer
A service for handling import of content.

Namespace

Drupal\Core\DefaultContent

Code

private function loadEntityDependency(string $target_uuid) : ?ContentEntityInterface {
    if ($this->dependencies && array_key_exists($target_uuid, $this->dependencies)) {
        $entity = $this->entityRepository
            ->loadEntityByUuid(...$this->dependencies[$target_uuid]);
        assert($entity instanceof ContentEntityInterface || $entity === NULL);
        return $entity;
    }
    return NULL;
}

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