lib/Doctrine/DBAL/Query/QueryBuilder.php
public function groupBy($groupBy)
    {
        if (empty($groupBy)) {
            return $this;
        }

        $groupBy = is_array($groupBy) ? $groupBy : func_get_args();

        return $this->add('groupBy', $groupBy, false);
    }
public function groupBy($groupBy)
    {
        if (empty($groupBy)) {
            return $this;
        }

        $groupBy = is_array($groupBy) ? $groupBy : func_get_args();

        return $this->add('groupBy', $groupBy, false);
    }
public function groupBy ( $ groupBy ) { if ( empty ( $ groupBy ) ) { return $ this ; } $ groupBy = is_array ( $ groupBy ) ? $ groupBy : func_get_args ( ) ; return $ this -> add ( 'groupBy' , $ groupBy , false ) ; }
Specifies a grouping over the results of the query.
Replaces any previously specified groupings, if any.

<code>
$qb = $conn->createQueryBuilder()
->select('u.name')
->from('users', 'u')
->groupBy('u.id');
</code>

@param mixed $groupBy The grouping expression.

@return $this This QueryBuilder instance.
Specifies a grouping over the results of the query . Replaces any previously specified groupings if any .