/**
  * Move the given node instance to the target workspace
  *
  * If no target node variant (having the same dimension values) exists in the target workspace, the node that
  * is published will be used as a new node variant in the target workspace.
  *
  * @param NodeInterface $node The node to publish
  * @param Workspace $targetWorkspace The workspace to publish to
  * @return void
  */
 protected function moveNodeVariantToTargetWorkspace(NodeInterface $node, Workspace $targetWorkspace)
 {
     $nodeData = $node->getNodeData();
     $this->handleShadowNodeData($nodeData, $targetWorkspace, $nodeData);
     // Technically this shouldn't be needed but due to doctrines behavior we need it.
     if ($nodeData->isRemoved() && $targetWorkspace->getBaseWorkspace() === null) {
         $this->nodeDataRepository->remove($nodeData);
         return;
     }
     $nodeData->setMovedTo(null);
     $nodeData->setWorkspace($targetWorkspace);
     $nodeData->setLastPublicationDateTime($this->now);
     $node->setNodeDataIsMatchingContext(null);
     $this->nodeService->cleanUpProperties($node);
 }
Ejemplo n.º 2
0
 /**
  * Move the given node instance to the target workspace
  *
  * If no target node variant (having the same dimension values) exists in the target workspace, the node that
  * is published will be used as a new node variant in the target workspace.
  *
  * @param NodeInterface $node The node to publish
  * @param Workspace $targetWorkspace The workspace to publish to
  * @return void
  */
 protected function moveNodeVariantToTargetWorkspace(NodeInterface $node, Workspace $targetWorkspace)
 {
     $nodeData = $node->getNodeData();
     $nodeData->setWorkspace($targetWorkspace);
     $node->setNodeDataIsMatchingContext(NULL);
 }