src/Sulu/Bundle/PageBundle/Controller/NodeController.php
public function postAction(Request $request)
    {
        $type = 'page';
        $language = $this->getLanguage($request);
        $action = $request->get('action');

        $this->checkActionParameterSecurity($action, $language);

        $document = $this->getDocumentManager()->create($type);
        $formType = $this->getMetadataFactory()->getMetadataForAlias($type)->getFormType();

        $this->persistDocument($request, $formType, $document, $language);
        $this->handleActionParameter($action, $document, $language);
        $this->getDocumentManager()->flush();

        $context = new Context();
        $context->setGroups(['defaultPage']);

        return $this->handleView($this->view($document)->setContext($context));
    }
public function postAction(Request $request)
    {
        $type = 'page';
        $language = $this->getLanguage($request);
        $action = $request->get('action');

        $this->checkActionParameterSecurity($action, $language);

        $document = $this->getDocumentManager()->create($type);
        $formType = $this->getMetadataFactory()->getMetadataForAlias($type)->getFormType();

        $this->persistDocument($request, $formType, $document, $language);
        $this->handleActionParameter($action, $document, $language);
        $this->getDocumentManager()->flush();

        $context = new Context();
        $context->setGroups(['defaultPage']);

        return $this->handleView($this->view($document)->setContext($context));
    }
public function postAction ( Request $ request ) { $ type = 'page' ; $ language = $ this -> getLanguage ( $ request ) ; $ action = $ request -> get ( 'action' ) ; $ this -> checkActionParameterSecurity ( $ action , $ language ) ; $ document = $ this -> getDocumentManager ( ) -> create ( $ type ) ; $ formType = $ this -> getMetadataFactory ( ) -> getMetadataForAlias ( $ type ) -> getFormType ( ) ; $ this -> persistDocument ( $ request , $ formType , $ document , $ language ) ; $ this -> handleActionParameter ( $ action , $ document , $ language ) ; $ this -> getDocumentManager ( ) -> flush ( ) ; $ context = new Context ( ) ; $ context -> setGroups ( [ 'defaultPage' ] ) ; return $ this -> handleView ( $ this -> view ( $ document ) -> setContext ( $ context ) ) ; }
Updates a content item and returns result as JSON String.

@param Request $request

@return Response

@throws InvalidFormException
@throws MissingParameterException
Updates a content item and returns result as JSON String .