summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2018-03-13 09:30:14 +0100
committerRoeland Jago Douma <roeland@famdouma.nl>2018-03-13 09:30:14 +0100
commitc6eba3c925cbdd7d305a21588af421ca5e6986f9 (patch)
tree290242fa27e443b8b110725dcc9c2ff2183983c7 /lib
parentafbad7e15ea1dc578d2af171b820d35c34899eb4 (diff)
downloadnextcloud-server-c6eba3c925cbdd7d305a21588af421ca5e6986f9.tar.gz
nextcloud-server-c6eba3c925cbdd7d305a21588af421ca5e6986f9.zip
Made addGroupBy varadic
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib')
-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 25e879b82be..57a0e1babd9 100644
--- a/lib/private/DB/QueryBuilder/QueryBuilder.php
+++ b/lib/private/DB/QueryBuilder/QueryBuilder.php
@@ -835,12 +835,14 @@ class QueryBuilder implements IQueryBuilder {
* ->addGroupBy('u.createdAt')
* </code>
*
- * @param mixed $groupBy The grouping expression.
+ * @param mixed ...$groupBy The grouping expression.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
*/
- public function addGroupBy($groupBy) {
- $groupBys = is_array($groupBy) ? $groupBy : func_get_args();
+ public function addGroupBy(...$groupBys) {
+ if (count($groupBys) === 1 && is_array($groupBys[0])) {
+ $$groupBys = $groupBys[0];
+ }
call_user_func_array(
[$this->queryBuilder, 'addGroupBy'],
diff --git a/lib/public/DB/QueryBuilder/IQueryBuilder.php b/lib/public/DB/QueryBuilder/IQueryBuilder.php
index 4f335c13c42..e6f4b43c24c 100644
--- a/lib/public/DB/QueryBuilder/IQueryBuilder.php
+++ b/lib/public/DB/QueryBuilder/IQueryBuilder.php
@@ -627,12 +627,12 @@ interface IQueryBuilder {
* ->addGroupBy('u.createdAt')
* </code>
*
- * @param mixed $groupBy The grouping expression.
+ * @param mixed ...$groupBy The grouping expression.
*
* @return \OCP\DB\QueryBuilder\IQueryBuilder This QueryBuilder instance.
* @since 8.2.0
*/
- public function addGroupBy($groupBy);
+ public function addGroupBy(...$groupBy);
/**
* Sets a value for a column in an insert query.