You are here

protected function ContentImporter::loadEntityByUuid in Commerce Demo 8

Same name and namespace in other branches
  1. 8.2 src/ContentImporter.php \Drupal\commerce_demo\ContentImporter::loadEntityByUuid()

Loads an entity by UUID.

Parameters

string $entity_type_id: The entity type ID.

int $entity_uuid: The entity UUID.

Return value

\Drupal\Core\Entity\EntityInterface|null The loaded entity, or NULL if none found.

1 call to ContentImporter::loadEntityByUuid()
ContentImporter::importEntity in src/ContentImporter.php
Imports a given entity.

File

src/ContentImporter.php, line 278

Class

ContentImporter
Defines the content importer.

Namespace

Drupal\commerce_demo

Code

protected function loadEntityByUuid($entity_type_id, $entity_uuid) {
  $storage = $this->entityTypeManager
    ->getStorage($entity_type_id);
  $entities = $storage
    ->loadByProperties([
    'uuid' => $entity_uuid,
  ]);
  return $entities ? reset($entities) : NULL;
}