Controller/PermissionsGroupController.php
public function deleteLinkRoleScopeAction($pgid, $rsid) 
    {
        $em = $this->getDoctrine()->getManager();
        
        $permissionsGroup = $em->getRepository('ChillMainBundle:PermissionsGroup')->find($pgid);
        $roleScope = $em->getRepository('ChillMainBundle:RoleScope')->find($rsid);

        if (!$permissionsGroup) {
            throw $this->createNotFoundException('Unable to find PermissionsGroup entity.');
        }
        
        if (!$roleScope) {
            throw $this->createNotFoundException('Unable to find RoleScope entity');
        }
        
        try {
            $permissionsGroup->removeRoleScope($roleScope);
        } catch (\RuntimeException $ex) {
            $this->addFlash('notice', 
                $this->get('translator')->trans("The role '%role%' and circle "
                        . "'%scope%' is not associated with this permission group", array(
                            '%role%' => $this->get('translator')->trans($roleScope->getRole()),
                            '%scope%' => $this->get('chill.main.helper.translatable_string')
                                ->localize($roleScope->getScope()->getName())
                        )));
            
            return $this->redirect($this->generateUrl('admin_permissionsgroup_edit', 
                array('id' => $pgid)));
        }
        
        $em->flush();
        
        $this->addFlash('notice', 
                $this->get('translator')->trans("The role '%role%' on circle "
                        . "'%scope%' has been removed", array(
                            '%role%' => $this->get('translator')->trans($roleScope->getRole()),
                            '%scope%' => $this->get('chill.main.helper.translatable_string')
                                ->localize($roleScope->getScope()->getName())
                        )));
        
        return $this->redirect($this->generateUrl('admin_permissionsgroup_edit', 
                array('id' => $pgid)));
    }
public function deleteLinkRoleScopeAction($pgid, $rsid) 
    {
        $em = $this->getDoctrine()->getManager();
        
        $permissionsGroup = $em->getRepository('ChillMainBundle:PermissionsGroup')->find($pgid);
        $roleScope = $em->getRepository('ChillMainBundle:RoleScope')->find($rsid);

        if (!$permissionsGroup) {
            throw $this->createNotFoundException('Unable to find PermissionsGroup entity.');
        }
        
        if (!$roleScope) {
            throw $this->createNotFoundException('Unable to find RoleScope entity');
        }
        
        try {
            $permissionsGroup->removeRoleScope($roleScope);
        } catch (\RuntimeException $ex) {
            $this->addFlash('notice', 
                $this->get('translator')->trans("The role '%role%' and circle "
                        . "'%scope%' is not associated with this permission group", array(
                            '%role%' => $this->get('translator')->trans($roleScope->getRole()),
                            '%scope%' => $this->get('chill.main.helper.translatable_string')
                                ->localize($roleScope->getScope()->getName())
                        )));
            
            return $this->redirect($this->generateUrl('admin_permissionsgroup_edit', 
                array('id' => $pgid)));
        }
        
        $em->flush();
        
        $this->addFlash('notice', 
                $this->get('translator')->trans("The role '%role%' on circle "
                        . "'%scope%' has been removed", array(
                            '%role%' => $this->get('translator')->trans($roleScope->getRole()),
                            '%scope%' => $this->get('chill.main.helper.translatable_string')
                                ->localize($roleScope->getScope()->getName())
                        )));
        
        return $this->redirect($this->generateUrl('admin_permissionsgroup_edit', 
                array('id' => $pgid)));
    }
public function deleteLinkRoleScopeAction ( $ pgid , $ rsid ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ permissionsGroup = $ em -> getRepository ( 'ChillMainBundle:PermissionsGroup' ) -> find ( $ pgid ) ; $ roleScope = $ em -> getRepository ( 'ChillMainBundle:RoleScope' ) -> find ( $ rsid ) ; if ( ! $ permissionsGroup ) { throw $ this -> createNotFoundException ( 'Unable to find PermissionsGroup entity.' ) ; } if ( ! $ roleScope ) { throw $ this -> createNotFoundException ( 'Unable to find RoleScope entity' ) ; } try { $ permissionsGroup -> removeRoleScope ( $ roleScope ) ; } catch ( \ RuntimeException $ ex ) { $ this -> addFlash ( 'notice' , $ this -> get ( 'translator' ) -> trans ( "The role '%role%' and circle " . "'%scope%' is not associated with this permission group" , array ( '%role%' => $ this -> get ( 'translator' ) -> trans ( $ roleScope -> getRole ( ) ) , '%scope%' => $ this -> get ( 'chill.main.helper.translatable_string' ) -> localize ( $ roleScope -> getScope ( ) -> getName ( ) ) ) ) ) ; return $ this -> redirect ( $ this -> generateUrl ( 'admin_permissionsgroup_edit' , array ( 'id' => $ pgid ) ) ) ; } $ em -> flush ( ) ; $ this -> addFlash ( 'notice' , $ this -> get ( 'translator' ) -> trans ( "The role '%role%' on circle " . "'%scope%' has been removed" , array ( '%role%' => $ this -> get ( 'translator' ) -> trans ( $ roleScope -> getRole ( ) ) , '%scope%' => $ this -> get ( 'chill.main.helper.translatable_string' ) -> localize ( $ roleScope -> getScope ( ) -> getName ( ) ) ) ) ) ; return $ this -> redirect ( $ this -> generateUrl ( 'admin_permissionsgroup_edit' , array ( 'id' => $ pgid ) ) ) ; }
remove an association between permissionsGroup and roleScope

@param int $pgid permissionsGroup id
@param int $rsid roleScope id
@return redirection to edit form
remove an association between permissionsGroup and roleScope