aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-03-13 09:29:36 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2018-03-13 09:29:36 +0100
commitafbad7e15ea1dc578d2af171b820d35c34899eb4 (patch)
tree80f219a4bedd91a8a848eda4ea62a460185e0564
parentd6b93e662024c35d02e8762d04c726c84c6c454a (diff)
downloadnextcloud-server-afbad7e15ea1dc578d2af171b820d35c34899eb4.tar.gz
nextcloud-server-afbad7e15ea1dc578d2af171b820d35c34899eb4.zip
Made groupBy varadic
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r--lib/private/DB/QueryBuilder/QueryBuilder.php8
-rw-r--r--lib/public/DB/QueryBuilder/IQueryBuilder.php4
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php
index 0d0e6594b50..25e879b82be 100644
--- a/lib/private/DB/QueryBuilder/QueryBuilder.php
+++ b/lib/private/DB/QueryBuilder/QueryBuilder.php
@@ -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'],
diff --git a/lib/public/DB/QueryBuilder/IQueryBuilder.php b/lib/public/DB/QueryBuilder/IQueryBuilder.php
index 876e77378e3..4f335c13c42 100644
--- a/lib/public/DB/QueryBuilder/IQueryBuilder.php
+++ b/lib/public/DB/QueryBuilder/IQueryBuilder.php
@@ -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.