Added support to define differnet not-found redirects per domain

This commit is contained in:
Alejandro Celaya
2021-07-21 09:28:21 +02:00
parent 2054784a4a
commit 4d48482d1e
14 changed files with 398 additions and 107 deletions

View File

@@ -54,10 +54,15 @@ class DomainService implements DomainServiceInterface
return $domain;
}
public function getOrCreate(string $authority): Domain
public function findByAuthority(string $authority): ?Domain
{
$repo = $this->em->getRepository(Domain::class);
$domain = $repo->findOneBy(['authority' => $authority]) ?? new Domain($authority);
return $repo->findOneBy(['authority' => $authority]);
}
public function getOrCreate(string $authority): Domain
{
$domain = $this->findByAuthority($authority) ?? new Domain($authority);
$this->em->persist($domain);
$this->em->flush();