Controller/GroupController.php
public function editAction(Request $request, $groupName)
    {
        $acl = $this->get('bacon_acl.service.authorization');

        if (!$acl->authorize('groups', 'EDIT')) {
            throw $this->createAccessDeniedException();
        }

        $group = $this->findGroupBy('name', $groupName);

        /** @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface */
        $dispatcher = $this->get('event_dispatcher');

        $event = new GetResponseGroupEvent($group, $request);
        $dispatcher->dispatch(FOSUserEvents::GROUP_EDIT_INITIALIZE, $event);

        if (null !== $event->getResponse()) {
            return $event->getResponse();
        }

        /** @var $formFactory \FOS\UserBundle\Form\Factory\FactoryInterface */
        $formFactory = $this->get('fos_user.group.form.factory');

        $form = $formFactory->createForm();
        $form->setData($group);

        $form->handleRequest($request);

        if ($form->isValid()) {
            /** @var $groupManager \FOS\UserBundle\Model\GroupManagerInterface */
            $groupManager = $this->get('fos_user.group_manager');

            $event = new FormEvent($form, $request);
            $dispatcher->dispatch(FOSUserEvents::GROUP_EDIT_SUCCESS, $event);

            $groupManager->updateGroup($group);

            $this->get('session')->getFlashBag()->add('message', [
                'type' => 'success',
                'message' => sprintf('The record has been %s successfully.','updated'),
            ]);


            if (null === $response = $event->getResponse()) {
                $url = $this->generateUrl('fos_user_group_show', array('groupName' => $group->getName()));
                $response = new RedirectResponse($url);
            }

            $dispatcher->dispatch(FOSUserEvents::GROUP_EDIT_COMPLETED, new FilterGroupResponseEvent($group, $request, $response));

            return $response;
        }

        return $this->render('FOSUserBundle:Group:edit.html.twig', array(
            'form'      => $form->createview(),
            'group_name'  => $group->getName(),
            'group'         => $group,
        ));
    }
public function editAction(Request $request, $groupName)
    {
        $acl = $this->get('bacon_acl.service.authorization');

        if (!$acl->authorize('groups', 'EDIT')) {
            throw $this->createAccessDeniedException();
        }

        $group = $this->findGroupBy('name', $groupName);

        /** @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface */
        $dispatcher = $this->get('event_dispatcher');

        $event = new GetResponseGroupEvent($group, $request);
        $dispatcher->dispatch(FOSUserEvents::GROUP_EDIT_INITIALIZE, $event);

        if (null !== $event->getResponse()) {
            return $event->getResponse();
        }

        /** @var $formFactory \FOS\UserBundle\Form\Factory\FactoryInterface */
        $formFactory = $this->get('fos_user.group.form.factory');

        $form = $formFactory->createForm();
        $form->setData($group);

        $form->handleRequest($request);

        if ($form->isValid()) {
            /** @var $groupManager \FOS\UserBundle\Model\GroupManagerInterface */
            $groupManager = $this->get('fos_user.group_manager');

            $event = new FormEvent($form, $request);
            $dispatcher->dispatch(FOSUserEvents::GROUP_EDIT_SUCCESS, $event);

            $groupManager->updateGroup($group);

            $this->get('session')->getFlashBag()->add('message', [
                'type' => 'success',
                'message' => sprintf('The record has been %s successfully.','updated'),
            ]);


            if (null === $response = $event->getResponse()) {
                $url = $this->generateUrl('fos_user_group_show', array('groupName' => $group->getName()));
                $response = new RedirectResponse($url);
            }

            $dispatcher->dispatch(FOSUserEvents::GROUP_EDIT_COMPLETED, new FilterGroupResponseEvent($group, $request, $response));

            return $response;
        }

        return $this->render('FOSUserBundle:Group:edit.html.twig', array(
            'form'      => $form->createview(),
            'group_name'  => $group->getName(),
            'group'         => $group,
        ));
    }
public function editAction ( Request $ request , $ groupName ) { $ acl = $ this -> get ( 'bacon_acl.service.authorization' ) ; if ( ! $ acl -> authorize ( 'groups' , 'EDIT' ) ) { throw $ this -> createAccessDeniedException ( ) ; } $ group = $ this -> findGroupBy ( 'name' , $ groupName ) ; /** @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface */ $ dispatcher = $ this -> get ( 'event_dispatcher' ) ; $ event = new GetResponseGroupEvent ( $ group , $ request ) ; $ dispatcher -> dispatch ( FOSUserEvents :: GROUP_EDIT_INITIALIZE , $ event ) ; if ( null !== $ event -> getResponse ( ) ) { return $ event -> getResponse ( ) ; } /** @var $formFactory \FOS\UserBundle\Form\Factory\FactoryInterface */ $ formFactory = $ this -> get ( 'fos_user.group.form.factory' ) ; $ form = $ formFactory -> createForm ( ) ; $ form -> setData ( $ group ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { /** @var $groupManager \FOS\UserBundle\Model\GroupManagerInterface */ $ groupManager = $ this -> get ( 'fos_user.group_manager' ) ; $ event = new FormEvent ( $ form , $ request ) ; $ dispatcher -> dispatch ( FOSUserEvents :: GROUP_EDIT_SUCCESS , $ event ) ; $ groupManager -> updateGroup ( $ group ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'message' , [ 'type' => 'success' , 'message' => sprintf ( 'The record has been %s successfully.' , 'updated' ) , ] ) ; if ( null === $ response = $ event -> getResponse ( ) ) { $ url = $ this -> generateUrl ( 'fos_user_group_show' , array ( 'groupName' => $ group -> getName ( ) ) ) ; $ response = new RedirectResponse ( $ url ) ; } $ dispatcher -> dispatch ( FOSUserEvents :: GROUP_EDIT_COMPLETED , new FilterGroupResponseEvent ( $ group , $ request , $ response ) ) ; return $ response ; } return $ this -> render ( 'FOSUserBundle:Group:edit.html.twig' , array ( 'form' => $ form -> createview ( ) , 'group_name' => $ group -> getName ( ) , 'group' => $ group , ) ) ; }
Edit one group, show the edit form
Edit one group show the edit form