You are here

public function CachedAttributesAwareEntityControllerTrait::getAttributes in Apigee Edge 8

File

src/Entity/Controller/CachedAttributesAwareEntityControllerTrait.php, line 51

Class

CachedAttributesAwareEntityControllerTrait
Helper trait for those entity controllers that supports attribute CRUDL.

Namespace

Drupal\apigee_edge\Entity\Controller

Code

public function getAttributes(string $entity_id) : AttributesProperty {
  $entity = $this
    ->entityCache()
    ->getEntity($entity_id);

  /** @var \Apigee\Edge\Entity\Property\AttributesPropertyInterface $entity */
  if ($entity) {
    return $entity
      ->getAttributes();
  }
  return $this
    ->decorated()
    ->getAttributes($entity_id);
}