Fix DB usersInGroups fetching

* Follow the interface defaults
* Only set limit or offset if they are properly set

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2019-10-02 09:43:35 +02:00
parent 74dcd84ee8
commit 6db51324fa
No known key found for this signature in database
GPG Key ID: F941078878347C0C
1 changed files with 8 additions and 3 deletions

View File

@ -322,7 +322,7 @@ class Database extends ABackend
* @param int $offset
* @return array an array of user ids
*/
public function usersInGroup($gid, $search = '', $limit = null, $offset = null) {
public function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) {
$this->fixDI();
$query = $this->dbConn->getQueryBuilder();
@ -337,8 +337,13 @@ class Database extends ABackend
)));
}
$query->setMaxResults($limit)
->setFirstResult($offset);
if ($limit !== -1) {
$query->setMaxResults($limit);
}
if ($offset !== 0) {
$query->setFirstResult($offset);
}
$result = $query->execute();
$users = [];