You are here

protected function ModeratedNodeListBuilder::getEntityRevisionIds in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/src/ModeratedNodeListBuilder.php \Drupal\content_moderation\ModeratedNodeListBuilder::getEntityRevisionIds()
  2. 9 core/modules/content_moderation/src/ModeratedNodeListBuilder.php \Drupal\content_moderation\ModeratedNodeListBuilder::getEntityRevisionIds()

Loads entity revision IDs using a pager sorted by the entity revision ID.

Return value

array An array of entity revision IDs.

1 call to ModeratedNodeListBuilder::getEntityRevisionIds()
ModeratedNodeListBuilder::load in core/modules/content_moderation/src/ModeratedNodeListBuilder.php
Loads entities of this type from storage for listing.

File

core/modules/content_moderation/src/ModeratedNodeListBuilder.php, line 81

Class

ModeratedNodeListBuilder
Defines a class to build a listing of moderated node entities.

Namespace

Drupal\content_moderation

Code

protected function getEntityRevisionIds() {
  $query = $this->entityTypeManager
    ->getStorage('content_moderation_state')
    ->getAggregateQuery()
    ->aggregate('content_entity_id', 'MAX')
    ->groupBy('content_entity_revision_id')
    ->condition('content_entity_type_id', $this->entityTypeId)
    ->condition('moderation_state', 'published', '<>')
    ->sort('content_entity_revision_id', 'DESC');

  // Only add the pager if a limit is specified.
  if ($this->limit) {
    $query
      ->pager($this->limit);
  }
  $result = $query
    ->execute();
  return $result ? array_column($result, 'content_entity_revision_id') : [];
}