public function WorkspaceMerger::getDifferringRevisionIdsOnSource in Drupal 10
Same name and namespace in other branches
- 8 core/modules/workspaces/src/WorkspaceMerger.php \Drupal\workspaces\WorkspaceMerger::getDifferringRevisionIdsOnSource()
- 9 core/modules/workspaces/src/WorkspaceMerger.php \Drupal\workspaces\WorkspaceMerger::getDifferringRevisionIdsOnSource()
File
- core/
modules/ workspaces/ src/ WorkspaceMerger.php, line 172
Class
- WorkspaceMerger
- Default implementation of the workspace merger.
Namespace
Drupal\workspacesCode
public function getDifferringRevisionIdsOnSource() {
$source_revision_difference = [];
$tracked_entities_on_source = $this->workspaceAssociation
->getTrackedEntities($this->sourceWorkspace
->id());
$tracked_entities_on_target = $this->workspaceAssociation
->getTrackedEntities($this->targetWorkspace
->id());
foreach ($tracked_entities_on_source as $entity_type_id => $tracked_revisions) {
// Now we compare the revision IDs which are tracked by the source
// workspace to those that are tracked by the target workspace, and the
// difference between these two arrays gives us all the entities which
// have a different revision ID on the source.
if (!isset($tracked_entities_on_target[$entity_type_id])) {
$source_revision_difference[$entity_type_id] = $tracked_revisions;
}
elseif ($revision_difference = array_diff_key($tracked_revisions, $tracked_entities_on_target[$entity_type_id])) {
$source_revision_difference[$entity_type_id] = $revision_difference;
}
}
return $source_revision_difference;
}