src/PN/Bundle/UserBundle/Controller/Administration/AdminController.php
/**
     * Displays a form to edit an existing admin entity.
     *
     * @Route("/{id}/edit", name="admin_edit", methods={"GET", "POST"})
     */
Displays a form to edit an existing admin entity.
Displays a form to edit an existing admin entity .
public function editAction(Request $request, User $user)
    {
        $this->denyAccessUnlessGranted('ROLE_ADMIN');
        $userManager = $this->get('fos_user.user_manager');
        $form = $this->getFormType($user);
        $form->setData($user);
        $form->handleRequest($request);
        if ($form->isSubmitted() && $form->isValid()) {
            $username = $this->get(UserService::class)->getUserName();
            $user->setModifiedBy($username);
            $userManager->updateUser($user);
            $this->addFlash('success', 'Successfully updated');
            return $this->redirectToRoute('admin_index');
        }
        return $this->render('user/admin/admin/edit.html.twig', array(
            'user' => $user,
            'form' => $form->createView(),
        ));
    }
public function editAction ( Request $ request , User $ user ) { $ this -> denyAccessUnlessGranted ( 'ROLE_ADMIN' ) ; $ userManager = $ this -> get ( 'fos_user.user_manager' ) ; $ form = $ this -> getFormType ( $ user ) ; $ form -> setData ( $ user ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ username = $ this -> get ( UserService :: class ) -> getUserName ( ) ; $ user -> setModifiedBy ( $ username ) ; $ userManager -> updateUser ( $ user ) ; $ this -> addFlash ( 'success' , 'Successfully updated' ) ; return $ this -> redirectToRoute ( 'admin_index' ) ; } return $ this -> render ( 'user/admin/admin/edit.html.twig' , array ( 'user' => $ user , 'form' => $ form -> createView ( ) , ) ) ; }
Displays a form to edit an existing admin entity.
Displays a form to edit an existing admin entity .