protected function ChangesListController::getEntitiesFromRevsDiff in Workspace 8
Parameters
$source_workspace \Drupal\multiversion\Entity\WorkspaceInterface:
$revs_diff array:
Return value
array
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
2 calls to ChangesListController::getEntitiesFromRevsDiff()
- ChangesListController::getChangesBetweenLocalWorkspaces in src/
Controller/ ChangesListController.php - Return the array with changed entities for workspaces on the same site.
- ChangesListController::getChangesBetweenRemoteWorkspaces in src/
Controller/ ChangesListController.php - Return the array with changed entities when target is a remote workspace.
File
- src/
Controller/ ChangesListController.php, line 218
Class
Namespace
Drupal\workspace\ControllerCode
protected function getEntitiesFromRevsDiff($source_workspace, $revs_diff) {
$entities = [];
$source_workspace_id = $source_workspace
->id();
foreach ($revs_diff as $uuid => $revs) {
foreach ($revs['missing'] as $rev) {
$item = $this->revIndex
->useWorkspace($source_workspace_id)
->get("{$uuid}:{$rev}");
$entity_type_id = $item['entity_type_id'];
$revision_id = $item['revision_id'];
/** @var \Drupal\multiversion\Entity\Storage\ContentEntityStorageInterface $storage */
$storage = $this
->entityTypeManager()
->getStorage($entity_type_id)
->useWorkspace($source_workspace_id);
$entity = $storage
->loadRevision($revision_id);
if ($entity instanceof ContentEntityInterface) {
$entities[] = $entity;
}
}
}
return $entities;
}