public function updateAction(Request $request, ContentNode $contentNode, $isSimpleForm = false)
    {
        $em = $this->getDoctrine()->getManager();
        $repository = $this->getDoctrine()->getRepository('MMCmfNodeBundle:Node');

        $rootNode = null;

        if ((int)$request->get('root_node')) {
            $rootNode = $repository->find((int)$request->get('root_node'));
        }

        //check if node need "simple" validation
        if ($isSimpleForm)
            $editForm = $this->createSimpleEditForm($contentNode, $rootNode);
        else
            $editForm = $this->createEditForm($contentNode, $rootNode);

        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();

            $markup = $this->get('mm_cmf_content.mm_cmf_parse_twig_extension')->cmfParse(
                $this->get('twig'),
                $contentNode
            );
            return new JsonResponse(array(
                    'success' => true,
                    'data' => array(
                        'id' => $contentNode->getId(),
                        'markup' => $markup
                    ))
            );
        }

        return new JsonResponse(array('success' => false));
    }
public function updateAction(Request $request, ContentNode $contentNode, $isSimpleForm = false)
    {
        $em = $this->getDoctrine()->getManager();
        $repository = $this->getDoctrine()->getRepository('MMCmfNodeBundle:Node');

        $rootNode = null;

        if ((int)$request->get('root_node')) {
            $rootNode = $repository->find((int)$request->get('root_node'));
        }

        //check if node need "simple" validation
        if ($isSimpleForm)
            $editForm = $this->createSimpleEditForm($contentNode, $rootNode);
        else
            $editForm = $this->createEditForm($contentNode, $rootNode);

        $editForm->handleRequest($request);

        if ($editForm->isValid()) {
            $em->flush();

            $markup = $this->get('mm_cmf_content.mm_cmf_parse_twig_extension')->cmfParse(
                $this->get('twig'),
                $contentNode
            );
            return new JsonResponse(array(
                    'success' => true,
                    'data' => array(
                        'id' => $contentNode->getId(),
                        'markup' => $markup
                    ))
            );
        }

        return new JsonResponse(array('success' => false));
    }
public function updateAction ( Request $ request , ContentNode $ contentNode , $ isSimpleForm = false ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ repository = $ this -> getDoctrine ( ) -> getRepository ( 'MMCmfNodeBundle:Node' ) ; $ rootNode = null ; if ( ( int ) $ request -> get ( 'root_node' ) ) { $ rootNode = $ repository -> find ( ( int ) $ request -> get ( 'root_node' ) ) ; } //check if node need "simple" validation if ( $ isSimpleForm ) $ editForm = $ this -> createSimpleEditForm ( $ contentNode , $ rootNode ) ; else $ editForm = $ this -> createEditForm ( $ contentNode , $ rootNode ) ; $ editForm -> handleRequest ( $ request ) ; if ( $ editForm -> isValid ( ) ) { $ em -> flush ( ) ; $ markup = $ this -> get ( 'mm_cmf_content.mm_cmf_parse_twig_extension' ) -> cmfParse ( $ this -> get ( 'twig' ) , $ contentNode ) ; return new JsonResponse ( array ( 'success' => true , 'data' => array ( 'id' => $ contentNode -> getId ( ) , 'markup' => $ markup ) ) ) ; } return new JsonResponse ( array ( 'success' => false ) ) ; }
validates the general ContentNode Form

@param Request $request
@param ContentNode $contentNode
@param bool $isSimpleForm
@return JsonResponse
validates the general ContentNode Form