Neos\Neos\Service\Controller\NodeController::moveAction PHP Method

moveAction() public method

We need to call persistAll() in order to return the nextUri. We can't persist only the nodes in NodeDataRepository because they might be connected to images / resources which need to be updated at the same time.
public moveAction ( Node $node, Node $targetNode, string $position ) : void
$node Neos\ContentRepository\Domain\Model\Node The node to be moved
$targetNode Neos\ContentRepository\Domain\Model\Node The target node to be moved "to", see $position
$position string where the node should be added (allowed: before, into, after)
return void
    public function moveAction(Node $node, Node $targetNode, $position)
    {
        $node = $this->nodeOperations->move($node, $targetNode, $position);
        if ($this->request->getHttpRequest()->isMethodSafe() === false) {
            $this->persistenceManager->persistAll();
        }
        $data = array('newNodePath' => $node->getContextPath());
        if ($node->getNodeType()->isOfType('Neos.Neos:Document')) {
            $data['nextUri'] = $this->uriBuilder->reset()->setFormat('html')->setCreateAbsoluteUri(true)->uriFor('show', array('node' => $node), 'Frontend\\Node', 'Neos.Neos');
        }
        $this->view->assign('value', array('data' => $data, 'success' => true));
    }