You are here

public function CachedPaginatedEntityIdListingControllerTrait::getEntityIds in Apigee Edge 8

File

src/Entity/Controller/CachedPaginatedEntityIdListingControllerTrait.php, line 60

Class

CachedPaginatedEntityIdListingControllerTrait
For those controllers that supports paginated entity id listing.

Namespace

Drupal\apigee_edge\Entity\Controller

Code

public function getEntityIds(PagerInterface $pager = NULL) : array {
  if ($this
    ->entityIdCache()
    ->isAllIdsInCache()) {
    if ($pager === NULL) {
      return $this
        ->entityIdCache()
        ->getIds();
    }
    else {
      return $this
        ->extractSubsetOfAssociativeArray($this
        ->entityIdCache()
        ->getIds(), $pager
        ->getLimit(), $pager
        ->getStartKey());
    }
  }
  $ids = $this
    ->decorated()
    ->getEntityIds($pager);
  $this
    ->entityIdCache()
    ->saveIds($ids);
  if ($pager === NULL) {
    $this
      ->entityIdCache()
      ->allIdsInCache(TRUE);
  }
  return $ids;
}