Neos.Neos/Classes/Service/Controller/NodeController.php
public function createAction(Node $referenceNode, array $nodeData, $position)
    {
        $newNode = $this->nodeOperations->create($referenceNode, $nodeData, $position);

        if ($this->request->getHttpRequest()->isMethodSafe() === false) {
            $this->persistenceManager->persistAll();
        }

        $nextUri = $this->uriBuilder->reset()->setFormat('html')->setCreateAbsoluteUri(true)->uriFor('show', ['node' => $newNode], 'Frontend\Node', 'Neos.Neos');
        $this->view->assign('value', ['data' => ['nextUri' => $nextUri], 'success' => true]);
    }
public function createAction(Node $referenceNode, array $nodeData, $position)
    {
        $newNode = $this->nodeOperations->create($referenceNode, $nodeData, $position);

        if ($this->request->getHttpRequest()->isMethodSafe() === false) {
            $this->persistenceManager->persistAll();
        }

        $nextUri = $this->uriBuilder->reset()->setFormat('html')->setCreateAbsoluteUri(true)->uriFor('show', ['node' => $newNode], 'Frontend\Node', 'Neos.Neos');
        $this->view->assign('value', ['data' => ['nextUri' => $nextUri], 'success' => true]);
    }
public function createAction ( Node $ referenceNode , array $ nodeData , $ position ) { $ newNode = $ this -> nodeOperations -> create ( $ referenceNode , $ nodeData , $ position ) ; if ( $ this -> request -> getHttpRequest ( ) -> isMethodSafe ( ) === false ) { $ this -> persistenceManager -> persistAll ( ) ; } $ nextUri = $ this -> uriBuilder -> reset ( ) -> setFormat ( 'html' ) -> setCreateAbsoluteUri ( true ) -> uriFor ( 'show' , [ 'node' => $ newNode ] , 'Frontend\Node' , 'Neos.Neos' ) ; $ this -> view -> assign ( 'value' , [ 'data' => [ 'nextUri' => $ nextUri ] , 'success' => true ] ) ; }
Creates a new node

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 $referenceNode
@param array $nodeData
@param string $position where the node should be added (allowed: before, into, after)
@return void
Creates a new node