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