Added support for an optional title field in short URLs

This commit is contained in:
Alejandro Celaya
2021-02-02 20:21:48 +01:00
parent 31a7212a71
commit 430c407106
8 changed files with 71 additions and 7 deletions

View File

@@ -38,6 +38,7 @@ class ShortUrl extends AbstractEntity
private ?string $importSource = null;
private ?string $importOriginalShortCode = null;
private ?ApiKey $authorApiKey = null;
private ?string $title = null;
private function __construct()
{
@@ -72,6 +73,7 @@ class ShortUrl extends AbstractEntity
$instance->shortCode = $meta->getCustomSlug() ?? generateRandomShortCode($instance->shortCodeLength);
$instance->domain = $relationResolver->resolveDomain($meta->getDomain());
$instance->authorApiKey = $meta->getApiKey();
$instance->title = $meta->getTitle();
return $instance;
}
@@ -157,6 +159,11 @@ class ShortUrl extends AbstractEntity
return $this->maxVisits;
}
public function getTitle(): ?string
{
return $this->title;
}
public function update(
ShortUrlEdit $shortUrlEdit,
?ShortUrlRelationResolverInterface $relationResolver = null