mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-11 01:33:11 +08:00
Added logic to check if a short code is in use and regenerate it otherwise
This commit is contained in:
@@ -155,7 +155,7 @@ DQL;
|
||||
return $shortUrl !== null && ! $shortUrl->maxVisitsReached() ? $shortUrl : null;
|
||||
}
|
||||
|
||||
public function slugIsInUse(string $slug, ?string $domain = null): bool
|
||||
public function shortCodeIsInUse(string $slug, ?string $domain = null): bool
|
||||
{
|
||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||
$qb->select('COUNT(DISTINCT s.id)')
|
||||
|
||||
@@ -29,5 +29,5 @@ interface ShortUrlRepositoryInterface extends ObjectRepository
|
||||
|
||||
public function findOneByShortCode(string $shortCode, ?string $domain = null): ?ShortUrl;
|
||||
|
||||
public function slugIsInUse(string $slug, ?string $domain): bool;
|
||||
public function shortCodeIsInUse(string $slug, ?string $domain): bool;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user