src/Sulu/Bundle/SecurityBundle/Entity/UserRepository.php
public function findAllUsersByRoleId($roleId)
    {
        $qb = $this->createQueryBuilder('user')
            ->leftJoin('user.userRoles', 'userRole')
            ->leftJoin('userRole.role', 'role')
            ->where('role=:roleId');

        $query = $qb->getQuery();
        $query->setParameter('roleId', $roleId);

        return $query->getResult();
    }
public function findAllUsersByRoleId($roleId)
    {
        $qb = $this->createQueryBuilder('user')
            ->leftJoin('user.userRoles', 'userRole')
            ->leftJoin('userRole.role', 'role')
            ->where('role=:roleId');

        $query = $qb->getQuery();
        $query->setParameter('roleId', $roleId);

        return $query->getResult();
    }
public function findAllUsersByRoleId ( $ roleId ) { $ qb = $ this -> createQueryBuilder ( 'user' ) -> leftJoin ( 'user.userRoles' , 'userRole' ) -> leftJoin ( 'userRole.role' , 'role' ) -> where ( 'role=:roleId' ) ; $ query = $ qb -> getQuery ( ) ; $ query -> setParameter ( 'roleId' , $ roleId ) ; return $ query -> getResult ( ) ; }
Finds all users for the role with the given id.

@param int $roleId

@return array
Finds all users for the role with the given id .