src/Kunstmaan/UserManagementBundle/Controller/GroupsController.php
public function editAction(Request $request, $id)
    {
        $this->denyAccessUnlessGranted('ROLE_SUPER_ADMIN');

        /* @var $em EntityManager */
        $em = $this->getDoctrine()->getManager();
        /* @var Group $group */
        $group = $em->getRepository('KunstmaanAdminBundle:Group')->find($id);
        $form = $this->createForm(GroupType::class, $group);

        if ($request->isMethod('POST')) {
            $form->handleRequest($request);
            if ($form->isSubmitted() && $form->isValid()) {
                $em->persist($group);
                $em->flush();

                $this->addFlash(
                    FlashTypes::SUCCESS,
                    $this->container->get('translator')->trans('kuma_user.group.edit.flash.success', array(
                        '%groupname%' => $group->getName(),
                    ))
                );

                return new RedirectResponse($this->generateUrl('KunstmaanUserManagementBundle_settings_groups'));
            }
        }

        return array(
            'form' => $form->createView(),
            'group' => $group,
        );
    }
public function editAction(Request $request, $id)
    {
        $this->denyAccessUnlessGranted('ROLE_SUPER_ADMIN');

        /* @var $em EntityManager */
        $em = $this->getDoctrine()->getManager();
        /* @var Group $group */
        $group = $em->getRepository('KunstmaanAdminBundle:Group')->find($id);
        $form = $this->createForm(GroupType::class, $group);

        if ($request->isMethod('POST')) {
            $form->handleRequest($request);
            if ($form->isSubmitted() && $form->isValid()) {
                $em->persist($group);
                $em->flush();

                $this->addFlash(
                    FlashTypes::SUCCESS,
                    $this->container->get('translator')->trans('kuma_user.group.edit.flash.success', array(
                        '%groupname%' => $group->getName(),
                    ))
                );

                return new RedirectResponse($this->generateUrl('KunstmaanUserManagementBundle_settings_groups'));
            }
        }

        return array(
            'form' => $form->createView(),
            'group' => $group,
        );
    }
public function editAction ( Request $ request , $ id ) { $ this -> denyAccessUnlessGranted ( 'ROLE_SUPER_ADMIN' ) ; /* @var $em EntityManager */ $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; /* @var Group $group */ $ group = $ em -> getRepository ( 'KunstmaanAdminBundle:Group' ) -> find ( $ id ) ; $ form = $ this -> createForm ( GroupType :: class , $ group ) ; if ( $ request -> isMethod ( 'POST' ) ) { $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em -> persist ( $ group ) ; $ em -> flush ( ) ; $ this -> addFlash ( FlashTypes :: SUCCESS , $ this -> container -> get ( 'translator' ) -> trans ( 'kuma_user.group.edit.flash.success' , array ( '%groupname%' => $ group -> getName ( ) , ) ) ) ; return new RedirectResponse ( $ this -> generateUrl ( 'KunstmaanUserManagementBundle_settings_groups' ) ) ; } } return array ( 'form' => $ form -> createView ( ) , 'group' => $ group , ) ; }
Edit a group

@param int $id

@Route("/{id}/edit", requirements={"id" = "\d+"}, name="KunstmaanUserManagementBundle_settings_groups_edit", methods={"GET", "POST"})
@Template("@KunstmaanUserManagement/Groups/edit.html.twig")

@throws AccessDeniedException

@return array
Edit a group