You are here

protected function SqlContentEntityStorage::doLoadMultipleRevisionsFieldItems in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php \Drupal\Core\Entity\Sql\SqlContentEntityStorage::doLoadMultipleRevisionsFieldItems()

Actually loads revision field item values from the storage.

Parameters

array $revision_ids: An array of revision identifiers.

Return value

\Drupal\Core\Entity\EntityInterface[] The specified entity revisions or an empty array if none are found.

Overrides ContentEntityStorageBase::doLoadMultipleRevisionsFieldItems

File

core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php, line 612

Class

SqlContentEntityStorage
A content entity database storage implementation.

Namespace

Drupal\Core\Entity\Sql

Code

protected function doLoadMultipleRevisionsFieldItems($revision_ids) {
  $revisions = [];

  // Sanitize IDs. Before feeding ID array into buildQuery, check whether
  // it is empty as this would load all entity revisions.
  $revision_ids = $this
    ->cleanIds($revision_ids, 'revision');
  if (!empty($revision_ids)) {

    // Build and execute the query.
    $query_result = $this
      ->buildQuery(NULL, $revision_ids)
      ->execute();
    $records = $query_result
      ->fetchAllAssoc($this->revisionKey);

    // Map the loaded records into entity objects and according fields.
    if ($records) {
      $revisions = $this
        ->mapFromStorageRecords($records, TRUE);
    }
  }
  return $revisions;
}