function ModeratedNodeListBuilder::getEntityRevisionIds

Same name in other branches
  1. 9 core/modules/content_moderation/src/ModeratedNodeListBuilder.php \Drupal\content_moderation\ModeratedNodeListBuilder::getEntityRevisionIds()
  2. 10 core/modules/content_moderation/src/ModeratedNodeListBuilder.php \Drupal\content_moderation\ModeratedNodeListBuilder::getEntityRevisionIds()
  3. 11.x 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') : [];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.