Made groupBy varadic

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2018-03-13 09:29:36 +01:00
parent d6b93e6620
commit afbad7e15e
No known key found for this signature in database
GPG Key ID: F941078878347C0C
2 changed files with 7 additions and 5 deletions

View File

@ -807,12 +807,14 @@ class QueryBuilder implements IQueryBuilder {
* ->groupBy('u.id');
* </code>
*
* @param mixed $groupBy The grouping expression.
* @param mixed ...$groupBys The grouping expression.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*/
public function groupBy($groupBy) {
$groupBys = is_array($groupBy) ? $groupBy : func_get_args();
public function groupBy(...$groupBys) {
if (count($groupBys) === 1 && is_array($groupBys[0])) {
$$groupBys = $groupBys[0];
}
call_user_func_array(
[$this->queryBuilder, 'groupBy'],

View File

@ -609,12 +609,12 @@ interface IQueryBuilder {
* ->groupBy('u.id');
* </code>
*
* @param mixed $groupBy The grouping expression.
* @param mixed ...$groupBys The grouping expression.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
* @since 8.2.0
*/
public function groupBy($groupBy);
public function groupBy(...$groupBys);
/**
* Adds a grouping expression to the query.