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

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

        $group = $this->findGroupBy('name', $groupName);
        $this->get('fos_user.group_manager')->deleteGroup($group);

        $response = new RedirectResponse($this->generateUrl('fos_user_group_list'));

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

        /** @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface */
        $dispatcher = $this->get('event_dispatcher');
        $dispatcher->dispatch(FOSUserEvents::GROUP_DELETE_COMPLETED, new FilterGroupResponseEvent($group, $request, $response));

        return $response;
    }
public function deleteAction(Request $request, $groupName)
    {
        $acl = $this->get('bacon_acl.service.authorization');

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

        $group = $this->findGroupBy('name', $groupName);
        $this->get('fos_user.group_manager')->deleteGroup($group);

        $response = new RedirectResponse($this->generateUrl('fos_user_group_list'));

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

        /** @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface */
        $dispatcher = $this->get('event_dispatcher');
        $dispatcher->dispatch(FOSUserEvents::GROUP_DELETE_COMPLETED, new FilterGroupResponseEvent($group, $request, $response));

        return $response;
    }
public function deleteAction ( Request $ request , $ groupName ) { $ acl = $ this -> get ( 'bacon_acl.service.authorization' ) ; if ( ! $ acl -> authorize ( 'groups' , 'DELETE' ) ) { throw $ this -> createAccessDeniedException ( ) ; } $ group = $ this -> findGroupBy ( 'name' , $ groupName ) ; $ this -> get ( 'fos_user.group_manager' ) -> deleteGroup ( $ group ) ; $ response = new RedirectResponse ( $ this -> generateUrl ( 'fos_user_group_list' ) ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'message' , [ 'type' => 'success' , 'message' => 'The record has been remove successfully.' , ] ) ; /** @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface */ $ dispatcher = $ this -> get ( 'event_dispatcher' ) ; $ dispatcher -> dispatch ( FOSUserEvents :: GROUP_DELETE_COMPLETED , new FilterGroupResponseEvent ( $ group , $ request , $ response ) ) ; return $ response ; }
Delete one group
Delete one group