You are here

public function ApiProductController::load in Apigee Edge 8

File

modules/apigee_edge_apiproduct_rbac/tests/modules/apigee_edge_apiproduct_rbac_test/src/ApiProductController.php, line 100

Class

ApiProductController
API product controller that reads and writes attributes from/to States API.

Namespace

Drupal\apigee_edge_apiproduct_rbac_test

Code

public function load(string $entity_id) : EntityInterface {
  $data = $this->state
    ->get($this
    ->generateApiProductStateKey($entity_id));
  if (NULL === $data) {
    throw new ApiException("API Product with {$entity_id} has not found in the storage.");
  }

  /** @var \Drupal\apigee_edge\Entity\ApiProduct $entity */
  $entity = $this->entitySerializer
    ->denormalize($data, ApiProduct::class);
  $this
    ->setAttributesFromStates($entity);
  return $entity;
}