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