diff --git a/src/Entity/Domain.php b/src/Entity/Domain.php index 6d4c66a..a73840d 100644 --- a/src/Entity/Domain.php +++ b/src/Entity/Domain.php @@ -106,6 +106,9 @@ class Domain #[Groups(['domain:item', 'domain:list', 'watchlist:item', 'watchlist:list'])] private ?bool $deleted; + #[Groups(['domain:item'])] + private ?RdapServer $rdapServer; + /** * @var Collection */ @@ -423,4 +426,14 @@ class Domain return $this; } + + public function getRdapServer(): ?RdapServer + { + return $this->rdapServer; + } + + public function setRdapServer(?RdapServer $rdapServer): void + { + $this->rdapServer = $rdapServer; + } } diff --git a/src/Entity/RdapServer.php b/src/Entity/RdapServer.php index 099d165..372984e 100644 --- a/src/Entity/RdapServer.php +++ b/src/Entity/RdapServer.php @@ -5,12 +5,14 @@ namespace App\Entity; use App\Repository\RdapServerRepository; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Symfony\Component\Serializer\Attribute\Groups; #[ORM\Entity(repositoryClass: RdapServerRepository::class)] class RdapServer { #[ORM\Id] #[ORM\Column(length: 255)] + #[Groups(['domain:item'])] private ?string $url = null; #[ORM\Column(type: Types::DATE_IMMUTABLE)] diff --git a/src/Service/RDAPService.php b/src/Service/RDAPService.php index 19038d2..933f0c5 100644 --- a/src/Service/RDAPService.php +++ b/src/Service/RDAPService.php @@ -144,6 +144,8 @@ readonly class RDAPService $domain = $this->initNewDomain($idnDomain, $tld); } + $domain->setRdapServer($rdapServer); + $this->updateDomainStatus($domain, $rdapData); if (in_array('free', $domain->getStatus())) { @@ -488,7 +490,8 @@ readonly class RDAPService * If there is no number to identify the entity, one is generated from the domain name and the roles associated with this entity */ if (!array_key_exists('handle', $rdapEntity) || '' === $rdapEntity['handle'] || in_array($rdapEntity['handle'], self::ENTITY_HANDLE_BLACKLIST)) { - $rdapEntity['handle'] = 'DW-FAKEHANDLE-'.$domain.'-'.join(',', $roles); + sort($roles); + $rdapEntity['handle'] = 'DW-FAKEHANDLE-'.$domain.'-'.implode(',', $roles); $this->logger->warning('The entity {handle} has no handle key.', [ 'handle' => $rdapEntity['handle'],