Neos.ContentRepository/Classes/Domain/Model/Workspace.php
protected function moveNodeVariantToTargetWorkspace(NodeInterface $nodeToPublish, Workspace $targetWorkspace)
    {
        $nodeData = $nodeToPublish->getNodeData();
        $this->adjustShadowNodeDataForNodePublishing($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);
        $nodeToPublish->setNodeDataIsMatchingContext(null);
        $this->nodeService->cleanUpProperties($nodeToPublish);
    }
protected function moveNodeVariantToTargetWorkspace(NodeInterface $nodeToPublish, Workspace $targetWorkspace)
    {
        $nodeData = $nodeToPublish->getNodeData();
        $this->adjustShadowNodeDataForNodePublishing($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);
        $nodeToPublish->setNodeDataIsMatchingContext(null);
        $this->nodeService->cleanUpProperties($nodeToPublish);
    }
protected function moveNodeVariantToTargetWorkspace ( NodeInterface $ nodeToPublish , Workspace $ targetWorkspace ) { $ nodeData = $ nodeToPublish -> getNodeData ( ) ; $ this -> adjustShadowNodeDataForNodePublishing ( $ 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 ) ; $ nodeToPublish -> setNodeDataIsMatchingContext ( null ) ; $ this -> nodeService -> cleanUpProperties ( $ nodeToPublish ) ; }
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 re-used as a new node variant in the target workspace.

@param NodeInterface $nodeToPublish The node to publish
@param Workspace $targetWorkspace The workspace to publish to
@return void
Move the given node instance to the target workspace