Extended TagRepositoryTest, covering filterings on tags

This commit is contained in:
Alejandro Celaya
2022-01-06 10:13:37 +01:00
parent e998c8434d
commit b38b8a3365
2 changed files with 84 additions and 16 deletions

View File

@@ -44,6 +44,12 @@ class TagRepository extends EntitySpecificationRepository implements TagReposito
->setMaxResults($filtering?->limit())
->setFirstResult($filtering?->offset());
$searchTerm = $filtering?->searchTerm();
if ($searchTerm !== null) {
$qb->andWhere($qb->expr()->like('t.name', ':searchPattern'))
->setParameter('searchPattern', '%' . $searchTerm . '%');
}
$apiKey = $filtering?->apiKey();
if ($apiKey !== null) {
$this->applySpecification($qb, $apiKey->spec(false, 'shortUrls'), 't');