/**
* Updates the specified node.
*
* Returns the following data:
*
* - the (possibly changed) workspace name of the node
* - the URI of the closest document node. If $node is a document node (f.e. a Page), the own URI is returned.
* This is important to handle renames of nodes correctly.
*
* Note: We do not call $nodeDataRepository->update() here, as ContentRepository has a stateful API for now.
* 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.
*
* @param Node $node The node to be updated
* @return void
*/
public function updateAction(Node $node)
{
if ($this->request->getHttpRequest()->isMethodSafe() === false) {
$this->persistenceManager->persistAll();
}
$q = new FlowQuery(array($node));
$closestDocumentNode = $q->closest('[instanceof Neos.Neos:Document]')->get(0);
$nextUri = $this->uriBuilder->reset()->setFormat('html')->setCreateAbsoluteUri(true)->uriFor('show', array('node' => $closestDocumentNode), 'Frontend\\Node', 'Neos.Neos');
$this->view->assign('value', array('data' => array('workspaceNameOfNode' => $node->getWorkspace()->getName(), 'labelOfNode' => $node->getLabel(), 'nextUri' => $nextUri), 'success' => true));
}