You are here

public function CachedEntityCrudOperationsControllerTrait::load in Apigee Edge 8

1 method overrides CachedEntityCrudOperationsControllerTrait::load()
AppByOwnerController::load in src/Entity/Controller/AppByOwnerController.php

File

src/Entity/Controller/CachedEntityCrudOperationsControllerTrait.php, line 68

Class

CachedEntityCrudOperationsControllerTrait
Helper trait for those entity controllers that supports all CRUD operations.

Namespace

Drupal\apigee_edge\Entity\Controller

Code

public function load(string $entity_id) : EntityInterface {
  $entity = $this
    ->entityCache()
    ->getEntity($entity_id);
  if ($entity === NULL) {
    $entity = $this
      ->decorated()
      ->load($entity_id);
    $this
      ->entityCache()
      ->saveEntities([
      $entity,
    ]);
  }
  return $entity;
}