public function findByGroup(
        Group $group,
        $executeQuery = true,
        $orderedBy = 'id',
        $order = 'ASC'
    ) {
        $dql = "
            SELECT DISTINCT u FROM Claroline\CoreBundle\Entity\User u
            JOIN u.groups g
            WHERE g.id = :groupId
            AND u.isRemoved = false
            ORDER BY u.{$orderedBy} {$order}
        ";
        $query = $this->_em->createQuery($dql);
        $query->setParameter('groupId', $group->getId());

        return $executeQuery ? $query->getResult() : $query;
    }
public function findByGroup(
        Group $group,
        $executeQuery = true,
        $orderedBy = 'id',
        $order = 'ASC'
    ) {
        $dql = "
            SELECT DISTINCT u FROM Claroline\CoreBundle\Entity\User u
            JOIN u.groups g
            WHERE g.id = :groupId
            AND u.isRemoved = false
            ORDER BY u.{$orderedBy} {$order}
        ";
        $query = $this->_em->createQuery($dql);
        $query->setParameter('groupId', $group->getId());

        return $executeQuery ? $query->getResult() : $query;
    }
public function findByGroup ( Group $ group , $ executeQuery = true , $ orderedBy = 'id' , $ order = 'ASC' ) { $ dql = "
            SELECT DISTINCT u FROM Claroline\CoreBundle\Entity\User u
            JOIN u.groups g
            WHERE g.id = :groupId
            AND u.isRemoved = false
            ORDER BY u.{$orderedBy} {$order}
        " ; $ query = $ this -> _em -> createQuery ( $ dql ) ; $ query -> setParameter ( 'groupId' , $ group -> getId ( ) ) ; return $ executeQuery ? $ query -> getResult ( ) : $ query ; }
Returns the users of a group.

@param Group  $group
@param bool   $executeQuery
@param string $orderedBy

@return User[]|Query
Returns the users of a group .