src/PN/Bundle/CMSBundle/Controller/Administration/BloggerController.php
/**
     * Displays a form to edit an existing blogger entity.
     *
     * @Route("/{id}/edit", name="blogger_edit", methods={"GET", "POST"})
     */
Displays a form to edit an existing blogger entity.
Displays a form to edit an existing blogger entity .
public function editAction(Request $request, Blogger $blogger) {
        $this->denyAccessUnlessGranted('ROLE_ADMIN');
        $em = $this->getDoctrine()->getManager();
        $editForm = $this->createForm(BloggerType::class, $blogger);
        $editForm->handleRequest($request);
        if ($editForm->isSubmitted() && $editForm->isValid()) {
            $userName = $this->get('user')->getUserName();
            $blogger->setModifiedBy($userName);
            $em->flush();
            $this->addFlash('success', 'Successfully updated');
            return $this->redirectToRoute('blogger_edit', array('id' => $blogger->getId()));
        }
        return $this->render('cms/admin/blogger/edit.html.twig', array(
                    'blogger' => $blogger,
                    'edit_form' => $editForm->createView(),
        ));
    }
public function editAction ( Request $ request , Blogger $ blogger ) { $ this -> denyAccessUnlessGranted ( 'ROLE_ADMIN' ) ; $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ editForm = $ this -> createForm ( BloggerType :: class , $ blogger ) ; $ editForm -> handleRequest ( $ request ) ; if ( $ editForm -> isSubmitted ( ) && $ editForm -> isValid ( ) ) { $ userName = $ this -> get ( 'user' ) -> getUserName ( ) ; $ blogger -> setModifiedBy ( $ userName ) ; $ em -> flush ( ) ; $ this -> addFlash ( 'success' , 'Successfully updated' ) ; return $ this -> redirectToRoute ( 'blogger_edit' , array ( 'id' => $ blogger -> getId ( ) ) ) ; } return $ this -> render ( 'cms/admin/blogger/edit.html.twig' , array ( 'blogger' => $ blogger , 'edit_form' => $ editForm -> createView ( ) , ) ) ; }
Displays a form to edit an existing blogger entity.
Displays a form to edit an existing blogger entity .