public function groupBy($groupBy)
    {
        /** @var array $groupFields */
        $groupFields = func_get_args();

        if (count($groupFields) > 0) {
            parent::groupBy($this->alias(array_shift($groupFields)));

            foreach ($groupFields as $group) {
                $this->addGroupBy($group);
            }
        }

        return $this;
    }
public function groupBy($groupBy)
    {
        /** @var array $groupFields */
        $groupFields = func_get_args();

        if (count($groupFields) > 0) {
            parent::groupBy($this->alias(array_shift($groupFields)));

            foreach ($groupFields as $group) {
                $this->addGroupBy($group);
            }
        }

        return $this;
    }
public function groupBy ( $ groupBy ) { /** @var array $groupFields */ $ groupFields = func_get_args ( ) ; if ( count ( $ groupFields ) > 0 ) { parent :: groupBy ( $ this -> alias ( array_shift ( $ groupFields ) ) ) ; foreach ( $ groupFields as $ group ) { $ this -> addGroupBy ( $ group ) ; } } return $ this ; }
Specifies a grouping over the results of the query.
Replaces any previously specified groupings, if any.

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

@param string $groupBy The grouping expression.

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