Moved short code uniqueness checks to external helper class that is used in UrlShortener and ImportedLinksProcessor

This commit is contained in:
Alejandro Celaya
2020-10-25 11:16:42 +01:00
parent b1a073b1ab
commit 786e4f642b
9 changed files with 180 additions and 82 deletions

View File

@@ -133,7 +133,7 @@ class ShortUrl extends AbstractEntity
/**
* @throws ShortCodeCannotBeRegeneratedException
*/
public function regenerateShortCode(): self
public function regenerateShortCode(): void
{
// In ShortUrls where a custom slug was provided, throw error, unless it is an imported one
if ($this->customSlugWasProvided && $this->importSource === null) {
@@ -146,7 +146,6 @@ class ShortUrl extends AbstractEntity
}
$this->shortCode = generateRandomShortCode($this->shortCodeLength);
return $this;
}
public function getValidSince(): ?Chronos