public function WorkspacePublisher::getDifferringRevisionIdsOnTarget in Drupal 10
Same name and namespace in other branches
- 8 core/modules/workspaces/src/WorkspacePublisher.php \Drupal\workspaces\WorkspacePublisher::getDifferringRevisionIdsOnTarget()
- 9 core/modules/workspaces/src/WorkspacePublisher.php \Drupal\workspaces\WorkspacePublisher::getDifferringRevisionIdsOnTarget()
File
- core/
modules/ workspaces/ src/ WorkspacePublisher.php, line 156
Class
- WorkspacePublisher
- Default implementation of the workspace publisher.
Namespace
Drupal\workspacesCode
public function getDifferringRevisionIdsOnTarget() {
$target_revision_difference = [];
$tracked_entities = $this->workspaceAssociation
->getTrackedEntities($this->sourceWorkspace
->id());
foreach ($tracked_entities as $entity_type_id => $tracked_revisions) {
$entity_type = $this->entityTypeManager
->getDefinition($entity_type_id);
// Get the latest revision IDs for all the entities that are tracked by
// the source workspace.
$query = $this->entityTypeManager
->getStorage($entity_type_id)
->getQuery()
->accessCheck(FALSE)
->condition($entity_type
->getKey('id'), $tracked_revisions, 'IN')
->latestRevision();
$result = $query
->execute();
// Now we compare the revision IDs which are tracked by the source
// workspace to the latest revision IDs of those entities and the
// difference between these two arrays gives us all the entities which
// have been modified on the target.
if ($revision_difference = array_diff_key($result, $tracked_revisions)) {
$target_revision_difference[$entity_type_id] = $revision_difference;
}
}
return $target_revision_difference;
}