本文整理汇总了PHP中Doctrine\DBAL\Query\QueryBuilder::addGroupBy方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryBuilder::addGroupBy方法的具体用法?PHP QueryBuilder::addGroupBy怎么用?PHP QueryBuilder::addGroupBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\DBAL\Query\QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder::addGroupBy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: distinct
/**
* @param QueryBuilder $builder
* @param string $modelClass
*
* @return QueryBuilder
*/
protected function distinct(QueryBuilder $builder, $modelClass)
{
// emulate SELECT DISTINCT (group by primary key)
$primaryColumn = $this->getModelSchemes()->getPrimaryKey($modelClass);
$fullPrimaryColumn = $this->getColumn($modelClass, $this->getTableName($modelClass), $primaryColumn);
$builder->addGroupBy($fullPrimaryColumn);
return $builder;
}
示例2: addGroupByQuotesIdentifierAndDelegatesToConcreteQueryBuilder
/**
* @test
*/
public function addGroupByQuotesIdentifierAndDelegatesToConcreteQueryBuilder()
{
$this->connection->quoteIdentifiers(['aField', 'anotherField'])->shouldBeCalled()->willReturnArgument(0);
$this->concreteQueryBuilder->addGroupBy('aField', 'anotherField')->shouldBeCalled()->willReturn($this->subject);
$this->subject->addGroupBy('aField', 'anotherField');
}
示例3: addGroupBy
/**
* Adds a grouping expression to the query.
*
* @param mixed $groupBy The grouping expression.
*
* @return self
*/
public function addGroupBy($groupBy)
{
$this->qb->addGroupBy($groupBy);
return $this;
}
示例4: addGroupBy
/**
* @inheritdoc
*/
protected function addGroupBy(QueryBuilder $queryBuilder)
{
$queryBuilder->addGroupBy('main.id');
}