Applied API role specs to short URL creation when findIfExists is provided

This commit is contained in:
Alejandro Celaya 2021-01-04 13:54:38 +01:00
parent 29cdfaed39
commit 364be2420b

View file

@ -234,6 +234,11 @@ class ShortUrlRepository extends EntitySpecificationRepository implements ShortU
->setParameter('domain', $meta->getDomain());
}
$apiKey = $meta->getApiKey();
if ($apiKey !== null) {
$this->applySpecification($qb, $apiKey->spec(), 's');
}
$tagsAmount = count($tags);
if ($tagsAmount === 0) {
return $qb->getQuery()->getOneOrNullResult();