You are here

protected function RevisionControllerTrait::revisionIds in Entity API 8

Same name and namespace in other branches
  1. 8.0 src/Controller/RevisionControllerTrait.php \Drupal\entity\Controller\RevisionControllerTrait::revisionIds()

Loads all revision IDs of an entity sorted by revision ID descending.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $entity: The entity.

Return value

mixed[]

1 call to RevisionControllerTrait::revisionIds()
RevisionControllerTrait::revisionOverview in src/Controller/RevisionControllerTrait.php
Generates an overview table of older revisions of an entity.

File

src/Controller/RevisionControllerTrait.php, line 96

Class

RevisionControllerTrait
Defines a trait for common revision UI functionality.

Namespace

Drupal\entity\Controller

Code

protected function revisionIds(ContentEntityInterface $entity) {
  $entity_type = $entity
    ->getEntityType();
  $result = $this
    ->entityTypeManager()
    ->getStorage($entity_type
    ->id())
    ->getQuery()
    ->allRevisions()
    ->condition($entity_type
    ->getKey('id'), $entity
    ->id())
    ->sort($entity_type
    ->getKey('revision'), 'DESC')
    ->execute();
  return array_keys($result);
}