diff options
-rw-r--r-- | lib/private/Group/Database.php | 10 | ||||
-rw-r--r-- | lib/public/GroupInterface.php | 2 |
2 files changed, 8 insertions, 4 deletions
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 |