From 7ad3574d71e0565438753cf94878723b540ae54f Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 8 Feb 2023 11:46:37 +0100 Subject: also update groupinterface and database backend Signed-off-by: Robin Appelman --- lib/private/Group/Database.php | 10 +++++++--- lib/public/GroupInterface.php | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php index 569cfa5007f..edfc76ef836 100644 --- a/lib/private/Group/Database.php +++ b/lib/private/Group/Database.php @@ -266,7 +266,7 @@ class Database extends ABackend implements * * Returns a list with all groups */ - public function getGroups($search = '', $limit = null, $offset = null) { + public function getGroups(string $search = '', int $limit = -1, int $offset = 0) { $this->fixDI(); $query = $this->dbConn->getQueryBuilder(); @@ -283,8 +283,12 @@ class Database extends ABackend implements ))); } - $query->setMaxResults($limit) - ->setFirstResult($offset); + if (!$limit > 0) { + $query->setMaxResults($limit); + } + if ($offset > 0) { + $query->setFirstResult($offset); + } $result = $query->execute(); $groups = []; diff --git a/lib/public/GroupInterface.php b/lib/public/GroupInterface.php index 56863100c05..a18d38df002 100644 --- a/lib/public/GroupInterface.php +++ b/lib/public/GroupInterface.php @@ -95,7 +95,7 @@ interface GroupInterface { * * Returns a list with all groups */ - public function getGroups($search = '', $limit = -1, $offset = 0); + public function getGroups(string $search = '', int $limit = -1, int $offset = 0); /** * check if a group exists -- cgit v1.2.3