Controller/PermissionsGroupController.php
protected function getPersistentRoleScopeBy($role, Scope $scope = null) 
    {
        $em = $this->getDoctrine()->getManager();
        
        $roleScope = $em->getRepository('ChillMainBundle:RoleScope')
                ->findOneBy(array('role' => $role, 'scope' => $scope));
        
        if ($roleScope === NULL) {
            $roleScope = (new RoleScope())
                    ->setRole($role)
                    ->setScope($scope)
                    ;
            
            $em->persist($roleScope);
        }
        
        return $roleScope;
    }
protected function getPersistentRoleScopeBy($role, Scope $scope = null) 
    {
        $em = $this->getDoctrine()->getManager();
        
        $roleScope = $em->getRepository('ChillMainBundle:RoleScope')
                ->findOneBy(array('role' => $role, 'scope' => $scope));
        
        if ($roleScope === NULL) {
            $roleScope = (new RoleScope())
                    ->setRole($role)
                    ->setScope($scope)
                    ;
            
            $em->persist($roleScope);
        }
        
        return $roleScope;
    }
protected function getPersistentRoleScopeBy ( $ role , Scope $ scope = null ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ roleScope = $ em -> getRepository ( 'ChillMainBundle:RoleScope' ) -> findOneBy ( array ( 'role' => $ role , 'scope' => $ scope ) ) ; if ( $ roleScope === NULL ) { $ roleScope = ( new RoleScope ( ) ) -> setRole ( $ role ) -> setScope ( $ scope ) ; $ em -> persist ( $ roleScope ) ; } return $ roleScope ; }
get a role scope by his parameters. The role scope is persisted if it
doesn't exists in database.

@param Scope $scope
@param string $role
@return RoleScope
get a role scope by his parameters . The role scope is persisted if it doesn t exists in database .