protected function LatestRevisionUpdateRunner::loadEntitiesToUpdate in Scheduled Updates 8
Load multi entities to update.
Parameters
$entity_ids: Keys of array should be revision id for revisionable entities Keys for non-revisionable entities will be entity keys.
Return value
Overrides BaseUpdateRunner::loadEntitiesToUpdate
File
- src/
Plugin/ UpdateRunner/ LatestRevisionUpdateRunner.php, line 62 - Contains \Drupal\scheduled_updates\Plugin\UpdateRunner\LatestRevisionUpdateRunner
Class
- LatestRevisionUpdateRunner
- The Latest Revision Update Runner.
Namespace
Drupal\scheduled_updates\Plugin\UpdateRunnerCode
protected function loadEntitiesToUpdate($entity_ids) {
$revision_ids = array_keys($entity_ids);
$entity_ids = array_unique($entity_ids);
$revisions = [];
foreach ($entity_ids as $entity_id) {
/** @var ContentEntityInterface $latest_revision */
$latest_revision = $this->updateUtils
->getLatestRevision($this
->updateEntityType(), $entity_id);
// Check the latest revision was in the revisions sent to this function.
if (in_array($latest_revision
->getRevisionId(), $revision_ids)) {
$revisions[$entity_id] = $latest_revision;
}
}
return $revisions;
}