main/core/Repository/GroupRepository.php
public function findGroupsByNames(array $names)
    {
        $nameCount = count($names);
        $dql = '
            SELECT g FROM Claroline\CoreBundle\Entity\Group g
            WHERE g.name IN (:names)
        ';

        $query = $this->_em->createQuery($dql);
        $query->setParameter('names', $names);

        $result = $query->getResult();

        if (($groupCount = count($result)) !== $nameCount) {
            throw new MissingObjectException("{$groupCount} out of {$nameCount} groups were found");
        }

        return $result;
    }
public function findGroupsByNames(array $names)
    {
        $nameCount = count($names);
        $dql = '
            SELECT g FROM Claroline\CoreBundle\Entity\Group g
            WHERE g.name IN (:names)
        ';

        $query = $this->_em->createQuery($dql);
        $query->setParameter('names', $names);

        $result = $query->getResult();

        if (($groupCount = count($result)) !== $nameCount) {
            throw new MissingObjectException("{$groupCount} out of {$nameCount} groups were found");
        }

        return $result;
    }
public function findGroupsByNames ( array $ names ) { $ nameCount = count ( $ names ) ; $ dql = '
            SELECT g FROM Claroline\CoreBundle\Entity\Group g
            WHERE g.name IN (:names)
        ' ; $ query = $ this -> _em -> createQuery ( $ dql ) ; $ query -> setParameter ( 'names' , $ names ) ; $ result = $ query -> getResult ( ) ; if ( ( $ groupCount = count ( $ result ) ) !== $ nameCount ) { throw new MissingObjectException ( "{$groupCount} out of {$nameCount} groups were found" ) ; } return $ result ; }
Returns groups by their names.

@param array $names

@return array[Group]

@throws MissingObjectException if one or more groups cannot be found
Returns groups by their names .