Skip to content
Snippets Groups Projects
Commit 019f57e1 authored by Jan-Hendrik Willms's avatar Jan-Hendrik Willms
Browse files

fix pagination for users index jsonapi route, fixes #4844

Closes #4844

Merge request studip/studip!3630
parent cab490d9
No related branches found
No related tags found
No related merge requests found
......@@ -35,8 +35,8 @@ class UsersIndex extends JsonApiController
$this->validateFilters();
$filters = $this->getFilters();
list($offset, $limit) = $this->getOffsetAndLimit();
$partSQL = \GlobalSearchUsers::getSQL($filters['search'], [], $limit + $offset);
[$offset, $limit] = $this->getOffsetAndLimit();
$partSQL = \GlobalSearchUsers::getSQL($filters['search'], [], "{$offset}, {$limit}");
$search_result = \DBManager::get()->fetchAll($partSQL);
$total = (int) \DBManager::get()->fetchColumn('SELECT FOUND_ROWS() as found_rows');
......
......@@ -29,6 +29,11 @@ class GlobalSearchUsers extends GlobalSearchModule implements GlobalSearchFullte
* @param string $search the input query string
* @param array $filter an array with search limiting filter information (e.g. 'category', 'semester', etc.)
* @return string SQL Query to discover elements for the search
*
* @todo If the signature of this method changes, the UsersIndex jsonapi
* route must also be taken into account. The route adds another
* parameter so that offset and limit can be used.
* @see \JsonApi\Routes\Users\UsersIndex::__invoke
*/
public static function getSQL($search, $filter, $limit)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment