src/PN/Bundle/CMSBundle/Controller/Administration/DynamicPageController.php
/**
     * Displays a form to edit an existing dynamicPage entity.
     *
     * @Route("/{id}/edit", name="dynamicpage_edit", methods={"GET", "POST"})
     */
Displays a form to edit an existing dynamicPage entity.
Displays a form to edit an existing dynamicPage entity .
public function editAction(Request $request, DynamicPage $dynamicPage) {
        $this->denyAccessUnlessGranted('ROLE_ADMIN');
        $em = $this->getDoctrine()->getManager();
        $editForm = $this->createForm(DynamicPageType::class, $dynamicPage);
        $formOptions = $editForm->get('post')->get('brief')->getConfig()->getOptions();
        $formOptions['required'] = false;
        $editForm->get('post')->add('brief', TextareaType::class, $formOptions);
        $editForm->handleRequest($request);
        if ($editForm->isSubmitted() && $editForm->isValid()) {
            $userName = $this->get('user')->getUserName();
            $dynamicPage->setModifiedBy($userName);
            $em->flush();
            $this->addFlash('success', 'Successfully updated');
            return $this->redirectToRoute('dynamicpage_edit', array('id' => $dynamicPage->getId()));
        }
        return $this->render('cms/admin/dynamicPage/edit.html.twig', array(
                    'dynamicPage' => $dynamicPage,
                    'edit_form' => $editForm->createView(),
        ));
    }
public function editAction ( Request $ request , DynamicPage $ dynamicPage ) { $ this -> denyAccessUnlessGranted ( 'ROLE_ADMIN' ) ; $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ editForm = $ this -> createForm ( DynamicPageType :: class , $ dynamicPage ) ; $ formOptions = $ editForm -> get ( 'post' ) -> get ( 'brief' ) -> getConfig ( ) -> getOptions ( ) ; $ formOptions [ 'required' ] = false ; $ editForm -> get ( 'post' ) -> add ( 'brief' , TextareaType :: class , $ formOptions ) ; $ editForm -> handleRequest ( $ request ) ; if ( $ editForm -> isSubmitted ( ) && $ editForm -> isValid ( ) ) { $ userName = $ this -> get ( 'user' ) -> getUserName ( ) ; $ dynamicPage -> setModifiedBy ( $ userName ) ; $ em -> flush ( ) ; $ this -> addFlash ( 'success' , 'Successfully updated' ) ; return $ this -> redirectToRoute ( 'dynamicpage_edit' , array ( 'id' => $ dynamicPage -> getId ( ) ) ) ; } return $ this -> render ( 'cms/admin/dynamicPage/edit.html.twig' , array ( 'dynamicPage' => $ dynamicPage , 'edit_form' => $ editForm -> createView ( ) , ) ) ; }
Displays a form to edit an existing dynamicPage entity.
Displays a form to edit an existing dynamicPage entity .