Added logic to persist device long URLs while creating/editing a short URL

This commit is contained in:
Alejandro Celaya
2023-01-15 13:08:21 +01:00
parent fdadf3ba07
commit a93edf158e
22 changed files with 142 additions and 98 deletions

View File

@@ -51,7 +51,7 @@ class DomainService implements DomainServiceInterface
$repo = $this->em->getRepository(Domain::class);
$groups = group(
$repo->findDomains($apiKey),
fn (Domain $domain) => $domain->getAuthority() === $this->defaultDomain ? 'default' : 'domains',
fn (Domain $domain) => $domain->authority() === $this->defaultDomain ? 'default' : 'domains',
);
return [first($groups['default'] ?? []), $groups['domains'] ?? []];

View File

@@ -24,14 +24,14 @@ class Domain extends AbstractEntity implements JsonSerializable, NotFoundRedirec
return new self($authority);
}
public function getAuthority(): string
public function authority(): string
{
return $this->authority;
}
public function jsonSerialize(): string
{
return $this->getAuthority();
return $this->authority;
}
public function invalidShortUrlRedirect(): ?string

View File

@@ -20,7 +20,7 @@ final class DomainItem implements JsonSerializable
public static function forNonDefaultDomain(Domain $domain): self
{
return new self($domain->getAuthority(), $domain, false);
return new self($domain->authority(), $domain, false);
}
public static function forDefaultDomain(string $defaultDomain, NotFoundRedirectConfigInterface $config): self