mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-12 01:54:41 +08:00
Added DB test for TagsPaginator
This commit is contained in:
@@ -11,11 +11,18 @@ class TagsPaginatorAdapter extends AbstractTagsPaginatorAdapter
|
||||
{
|
||||
public function getSlice(int $offset, int $length): iterable
|
||||
{
|
||||
return $this->repo->match(Spec::andX(
|
||||
$conditions = [
|
||||
new WithApiKeySpecsEnsuringJoin($this->apiKey),
|
||||
Spec::orderBy('name'),
|
||||
Spec::limit($length),
|
||||
Spec::offset($offset),
|
||||
));
|
||||
];
|
||||
|
||||
$searchTerm = $this->params->searchTerm();
|
||||
if ($searchTerm !== null) {
|
||||
$conditions[] = Spec::like('name', $searchTerm);
|
||||
}
|
||||
|
||||
return $this->repo->match(Spec::andX(...$conditions));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user