You are here

protected function WorkbenchModerationSubscriber::mergeWorkspaceToParent in Workspace 8

Merges a workspace to its parent workspace, if any.

Parameters

\Drupal\multiversion\Entity\WorkspaceInterface $workspace: The workspace entity to merge.

Return value

\Drupal\replication\Entity\ReplicationLog The replication log entry.

1 call to WorkbenchModerationSubscriber::mergeWorkspaceToParent()
WorkbenchModerationSubscriber::onTransition in src/EventSubscriber/WorkbenchModerationSubscriber.php
Listener for workbench moderation event transitions.

File

src/EventSubscriber/WorkbenchModerationSubscriber.php, line 108

Class

WorkbenchModerationSubscriber
Subscriber for workbench transitions.

Namespace

Drupal\workspace\EventSubscriber

Code

protected function mergeWorkspaceToParent(WorkspaceInterface $workspace) {

  /* @var \Drupal\workspace\WorkspacePointerInterface $parent_workspace */
  $parent_workspace_pointer = $workspace
    ->get('upstream')->entity;

  /* @var \Drupal\workspace\WorkspacePointerInterface $source_pointer */
  $source_pointer = $this
    ->getPointerToWorkspace($workspace);

  // Derive a replication task from the Workspace we are acting on.
  $task = $this->replicatorManager
    ->getTask($workspace, 'push_replication_settings');
  return $this->replicatorManager
    ->replicate($source_pointer, $parent_workspace_pointer, $task);
}