fix: duplicate key value violates unique constraint domain_pkey

This commit is contained in:
Maël Gangloff 2025-08-09 00:01:59 +02:00
parent 735e868727
commit bb30a092e8
No known key found for this signature in database
GPG Key ID: 11FDC81C24A7F629

View File

@ -153,7 +153,9 @@ readonly class RDAPService
throw new NotFoundHttpException("The domain name $idnDomain is not present in the WHOIS database."); throw new NotFoundHttpException("The domain name $idnDomain is not present in the WHOIS database.");
} }
$domain->setRdapServer($rdapServer)->setDelegationSigned(isset($rdapData['secureDNS']['delegationSigned']) && true === $rdapData['secureDNS']['delegationSigned']); $domain
->setRdapServer($rdapServer)
->setDelegationSigned(isset($rdapData['secureDNS']['delegationSigned']) && $rdapData['secureDNS']['delegationSigned']);
$this->updateDomainHandle($domain, $rdapData); $this->updateDomainHandle($domain, $rdapData);
@ -163,7 +165,6 @@ readonly class RDAPService
$domain->setDeleted(false)->updateTimestamps(); $domain->setDeleted(false)->updateTimestamps();
$this->em->persist($domain);
$this->em->flush(); $this->em->flush();
$this->em->commit(); $this->em->commit();
@ -364,7 +365,10 @@ readonly class RDAPService
$domainEntity->setDeleted(true); $domainEntity->setDeleted(true);
} }
if (isset($rdapData['entities']) && is_array($rdapData['entities'])) { if (!isset($rdapData['entities']) || !is_array($rdapData['entities'])) {
return;
}
foreach ($rdapData['entities'] as $rdapEntity) { foreach ($rdapData['entities'] as $rdapEntity) {
$roles = $this->extractEntityRoles($rdapData['entities'], $rdapEntity); $roles = $this->extractEntityRoles($rdapData['entities'], $rdapEntity);
$entity = $this->registerEntity($rdapEntity, $roles, $domain->getLdhName(), $domain->getTld()); $entity = $this->registerEntity($rdapEntity, $roles, $domain->getLdhName(), $domain->getTld());
@ -388,7 +392,6 @@ readonly class RDAPService
$this->em->flush(); $this->em->flush();
} }
} }
}
/** /**
* @throws \DateMalformedStringException * @throws \DateMalformedStringException