Inlcuded tags as part of the ShortUrlMeta

This commit is contained in:
Alejandro Celaya
2021-01-30 19:17:12 +01:00
parent 3f2bd657e1
commit 063ee9c195
14 changed files with 60 additions and 99 deletions

View File

@@ -201,7 +201,7 @@ class ShortUrlRepository extends EntitySpecificationRepository implements ShortU
return $qb;
}
public function findOneMatching(array $tags, ShortUrlMeta $meta): ?ShortUrl
public function findOneMatching(ShortUrlMeta $meta): ?ShortUrl
{
$qb = $this->getEntityManager()->createQueryBuilder();
@@ -239,6 +239,7 @@ class ShortUrlRepository extends EntitySpecificationRepository implements ShortU
$this->applySpecification($qb, $apiKey->spec(), 's');
}
$tags = $meta->getTags();
$tagsAmount = count($tags);
if ($tagsAmount === 0) {
return $qb->getQuery()->getOneOrNullResult();

View File

@@ -38,7 +38,7 @@ interface ShortUrlRepositoryInterface extends ObjectRepository, EntitySpecificat
public function shortCodeIsInUse(string $slug, ?string $domain, ?Specification $spec = null): bool;
public function findOneMatching(array $tags, ShortUrlMeta $meta): ?ShortUrl;
public function findOneMatching(ShortUrlMeta $meta): ?ShortUrl;
public function importedUrlExists(ImportedShlinkUrl $url): bool;
}