mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 09:45:29 +00:00
feat: add id column on entity
This commit is contained in:
parent
e7b8ce612e
commit
89a7daf882
145
migrations/Version20250217234033.php
Normal file
145
migrations/Version20250217234033.php
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20250217234033 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Add id column on entity';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('CREATE SEQUENCE entity_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
|
||||||
|
$this->addSql('ALTER TABLE entity DROP CONSTRAINT entity_pkey CASCADE');
|
||||||
|
$this->addSql('ALTER TABLE entity ADD id INT');
|
||||||
|
$this->addSql('UPDATE entity SET id = nextval(\'entity_id_seq\') WHERE id IS NULL;');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE entity ADD tld_id VARCHAR(63) DEFAULT NULL');
|
||||||
|
|
||||||
|
$this->addSql('UPDATE entity e
|
||||||
|
SET tld_id = (
|
||||||
|
CASE
|
||||||
|
WHEN e.handle ~ \'^[0-9]+$\' THEN NULL
|
||||||
|
ELSE (
|
||||||
|
SELECT d.tld_id
|
||||||
|
FROM domain_entity de
|
||||||
|
JOIN domain d ON de.domain_id = d.ldh_name
|
||||||
|
WHERE de.entity_id = e.handle
|
||||||
|
LIMIT 1
|
||||||
|
)
|
||||||
|
END
|
||||||
|
)
|
||||||
|
WHERE EXISTS (
|
||||||
|
SELECT 1
|
||||||
|
FROM domain_entity de
|
||||||
|
JOIN domain d ON de.domain_id = d.ldh_name
|
||||||
|
WHERE de.entity_id = e.handle
|
||||||
|
) OR e.handle ~ \'^[0-9]+$\';
|
||||||
|
');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE entity ADD CONSTRAINT FK_E28446850F7084E FOREIGN KEY (tld_id) REFERENCES tld (tld) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('CREATE INDEX IDX_E28446850F7084E ON entity (tld_id)');
|
||||||
|
$this->addSql('ALTER TABLE entity ADD PRIMARY KEY (id)');
|
||||||
|
|
||||||
|
$this->addSql('DROP INDEX idx_614b48a181257d5d');
|
||||||
|
$this->addSql('ALTER TABLE domain_entity DROP CONSTRAINT domain_entity_pkey');
|
||||||
|
$this->addSql('ALTER TABLE domain_entity ADD entity_uid INT');
|
||||||
|
|
||||||
|
$this->addSql('UPDATE domain_entity de
|
||||||
|
SET entity_uid = (
|
||||||
|
SELECT e.id
|
||||||
|
FROM entity e
|
||||||
|
WHERE e.handle = de.entity_id
|
||||||
|
)
|
||||||
|
WHERE de.entity_uid IS NULL;');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE domain_entity DROP entity_id');
|
||||||
|
$this->addSql('ALTER TABLE domain_entity ADD CONSTRAINT FK_614B48A12D1466A1 FOREIGN KEY (entity_uid) REFERENCES entity (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('CREATE INDEX IDX_614B48A12D1466A1 ON domain_entity (entity_uid)');
|
||||||
|
$this->addSql('ALTER TABLE domain_entity ADD PRIMARY KEY (domain_id, entity_uid)');
|
||||||
|
|
||||||
|
$this->addSql('DROP INDEX uniq_975a3f5e47cc8c92aa9e377a81257d5d');
|
||||||
|
$this->addSql('DROP INDEX idx_975a3f5e81257d5d');
|
||||||
|
$this->addSql('ALTER TABLE entity_event ADD entity_uid INT');
|
||||||
|
|
||||||
|
$this->addSql('UPDATE entity_event ee
|
||||||
|
SET entity_uid = (
|
||||||
|
SELECT e.id
|
||||||
|
FROM entity e
|
||||||
|
WHERE e.handle = ee.entity_id
|
||||||
|
)
|
||||||
|
WHERE ee.entity_uid IS NULL;');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE entity_event DROP entity_id');
|
||||||
|
$this->addSql('ALTER TABLE entity_event ADD CONSTRAINT FK_975A3F5E2D1466A1 FOREIGN KEY (entity_uid) REFERENCES entity (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('CREATE INDEX IDX_975A3F5E2D1466A1 ON entity_event (entity_uid)');
|
||||||
|
$this->addSql('CREATE UNIQUE INDEX UNIQ_975A3F5E47CC8C92AA9E377A2D1466A1 ON entity_event (action, date, entity_uid)');
|
||||||
|
|
||||||
|
$this->addSql('DROP INDEX idx_a269afb481257d5d');
|
||||||
|
$this->addSql('ALTER TABLE nameserver_entity DROP CONSTRAINT nameserver_entity_pkey');
|
||||||
|
$this->addSql('ALTER TABLE nameserver_entity ADD entity_uid INT');
|
||||||
|
|
||||||
|
$this->addSql('UPDATE nameserver_entity ne
|
||||||
|
SET entity_uid = (
|
||||||
|
SELECT e.id
|
||||||
|
FROM entity e
|
||||||
|
WHERE e.handle = ne.entity_id
|
||||||
|
)
|
||||||
|
WHERE ne.entity_uid IS NULL;');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE nameserver_entity DROP entity_id');
|
||||||
|
$this->addSql('ALTER TABLE nameserver_entity ADD CONSTRAINT FK_A269AFB42D1466A1 FOREIGN KEY (entity_uid) REFERENCES entity (id) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('CREATE INDEX IDX_A269AFB42D1466A1 ON nameserver_entity (entity_uid)');
|
||||||
|
$this->addSql('ALTER TABLE nameserver_entity ADD PRIMARY KEY (nameserver_id, entity_uid)');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
$this->addSql('DROP SEQUENCE entity_id_seq CASCADE');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE entity DROP CONSTRAINT FK_E28446850F7084E');
|
||||||
|
$this->addSql('DROP INDEX IDX_E28446850F7084E');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE entity DROP id');
|
||||||
|
$this->addSql('ALTER TABLE entity DROP tld_id');
|
||||||
|
$this->addSql('ALTER TABLE entity ADD PRIMARY KEY (handle)');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE nameserver_entity DROP CONSTRAINT FK_A269AFB42D1466A1');
|
||||||
|
$this->addSql('DROP INDEX IDX_A269AFB42D1466A1');
|
||||||
|
$this->addSql('DROP INDEX nameserver_entity_pkey');
|
||||||
|
$this->addSql('ALTER TABLE nameserver_entity ADD entity_id VARCHAR(255) NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE nameserver_entity DROP entity_uid');
|
||||||
|
$this->addSql('ALTER TABLE nameserver_entity ADD CONSTRAINT fk_a269afb481257d5d FOREIGN KEY (entity_id) REFERENCES entity (handle) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('CREATE INDEX idx_a269afb481257d5d ON nameserver_entity (entity_id)');
|
||||||
|
$this->addSql('ALTER TABLE nameserver_entity ADD PRIMARY KEY (nameserver_id, entity_id)');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE entity_event DROP CONSTRAINT FK_975A3F5E2D1466A1');
|
||||||
|
$this->addSql('DROP INDEX IDX_975A3F5E2D1466A1');
|
||||||
|
$this->addSql('DROP INDEX UNIQ_975A3F5E47CC8C92AA9E377A2D1466A1');
|
||||||
|
$this->addSql('ALTER TABLE entity_event ADD entity_id VARCHAR(255) NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE entity_event DROP entity_uid');
|
||||||
|
$this->addSql('ALTER TABLE entity_event ADD CONSTRAINT fk_975a3f5e81257d5d FOREIGN KEY (entity_id) REFERENCES entity (handle) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('CREATE UNIQUE INDEX uniq_975a3f5e47cc8c92aa9e377a81257d5d ON entity_event (action, date, entity_id)');
|
||||||
|
$this->addSql('CREATE INDEX idx_975a3f5e81257d5d ON entity_event (entity_id)');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE domain_entity DROP CONSTRAINT FK_614B48A12D1466A1');
|
||||||
|
$this->addSql('DROP INDEX IDX_614B48A12D1466A1');
|
||||||
|
$this->addSql('DROP INDEX domain_entity_pkey');
|
||||||
|
$this->addSql('ALTER TABLE domain_entity ADD entity_id VARCHAR(255) NOT NULL');
|
||||||
|
$this->addSql('ALTER TABLE domain_entity DROP entity_uid');
|
||||||
|
$this->addSql('ALTER TABLE domain_entity ADD CONSTRAINT fk_614b48a181257d5d FOREIGN KEY (entity_id) REFERENCES entity (handle) NOT DEFERRABLE INITIALLY IMMEDIATE');
|
||||||
|
$this->addSql('CREATE INDEX idx_614b48a181257d5d ON domain_entity (entity_id)');
|
||||||
|
$this->addSql('ALTER TABLE domain_entity ADD PRIMARY KEY (domain_id, entity_id)');
|
||||||
|
}
|
||||||
|
}
|
||||||
33
migrations/Version20250217235124.php
Normal file
33
migrations/Version20250217235124.php
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20250217235124 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription(): string
|
||||||
|
{
|
||||||
|
return 'Avoid that an entity can have the same handle on the same tld';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('CREATE UNIQUE INDEX UNIQ_E28446850F7084E918020D9 ON entity (tld_id, handle)');
|
||||||
|
$this->addSql('ALTER TABLE entity_event ALTER entity_uid SET NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema): void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->addSql('DROP INDEX UNIQ_E28446850F7084E918020D9');
|
||||||
|
$this->addSql('ALTER TABLE entity_event ALTER entity_uid DROP NOT NULL');
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -117,7 +117,7 @@ class Domain
|
|||||||
#[SerializedName('oldStatus')]
|
#[SerializedName('oldStatus')]
|
||||||
private Collection $domainStatuses;
|
private Collection $domainStatuses;
|
||||||
|
|
||||||
#[ORM\Column(nullable: false)]
|
#[ORM\Column(nullable: false, options: ['default' => false])]
|
||||||
#[Groups(['domain:item', 'domain:list'])]
|
#[Groups(['domain:item', 'domain:list'])]
|
||||||
private ?bool $delegationSigned = null;
|
private ?bool $delegationSigned = null;
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ class DomainEntity
|
|||||||
|
|
||||||
#[ORM\Id]
|
#[ORM\Id]
|
||||||
#[ORM\ManyToOne(targetEntity: Entity::class, cascade: ['persist'], inversedBy: 'domainEntities')]
|
#[ORM\ManyToOne(targetEntity: Entity::class, cascade: ['persist'], inversedBy: 'domainEntities')]
|
||||||
#[ORM\JoinColumn(referencedColumnName: 'handle', nullable: false)]
|
#[ORM\JoinColumn(name: 'entity_uid', referencedColumnName: 'id', nullable: false)]
|
||||||
#[Groups(['domain-entity:entity'])]
|
#[Groups(['domain-entity:entity'])]
|
||||||
private ?Entity $entity = null;
|
private ?Entity $entity = null;
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,9 @@ use Symfony\Component\Serializer\Attribute\Groups;
|
|||||||
use Symfony\Component\Serializer\Attribute\SerializedName;
|
use Symfony\Component\Serializer\Attribute\SerializedName;
|
||||||
|
|
||||||
#[ORM\Entity(repositoryClass: EntityRepository::class)]
|
#[ORM\Entity(repositoryClass: EntityRepository::class)]
|
||||||
|
#[ORM\UniqueConstraint(
|
||||||
|
columns: ['tld_id', 'handle']
|
||||||
|
)]
|
||||||
#[ApiResource(
|
#[ApiResource(
|
||||||
operations: [
|
operations: [
|
||||||
/*
|
/*
|
||||||
@ -21,7 +24,7 @@ use Symfony\Component\Serializer\Attribute\SerializedName;
|
|||||||
),
|
),
|
||||||
*/
|
*/
|
||||||
new Get(
|
new Get(
|
||||||
uriTemplate: '/entities/{handle}',
|
uriTemplate: '/entities/{id}',
|
||||||
normalizationContext: [
|
normalizationContext: [
|
||||||
'groups' => [
|
'groups' => [
|
||||||
'event:list',
|
'event:list',
|
||||||
@ -38,6 +41,15 @@ use Symfony\Component\Serializer\Attribute\SerializedName;
|
|||||||
class Entity
|
class Entity
|
||||||
{
|
{
|
||||||
#[ORM\Id]
|
#[ORM\Id]
|
||||||
|
#[ORM\GeneratedValue]
|
||||||
|
#[ORM\Column]
|
||||||
|
private ?int $id = null;
|
||||||
|
|
||||||
|
#[ORM\ManyToOne(targetEntity: Tld::class, inversedBy: 'entities')]
|
||||||
|
#[ORM\JoinColumn(referencedColumnName: 'tld', nullable: true)]
|
||||||
|
#[Groups(['entity:list', 'entity:item', 'domain:item'])]
|
||||||
|
private ?Tld $tld = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 255)]
|
#[ORM\Column(length: 255)]
|
||||||
#[Groups(['entity:list', 'entity:item', 'domain:item'])]
|
#[Groups(['entity:list', 'entity:item', 'domain:item'])]
|
||||||
private ?string $handle = null;
|
private ?string $handle = null;
|
||||||
@ -205,4 +217,28 @@ class Entity
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getId(): ?int
|
||||||
|
{
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setId(int $id): static
|
||||||
|
{
|
||||||
|
$this->id = $id;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getTld(): ?Tld
|
||||||
|
{
|
||||||
|
return $this->tld;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setTld(?Tld $tld): static
|
||||||
|
{
|
||||||
|
$this->tld = $tld;
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,12 +7,12 @@ use Doctrine\ORM\Mapping as ORM;
|
|||||||
|
|
||||||
#[ORM\Entity(repositoryClass: EntityEventRepository::class)]
|
#[ORM\Entity(repositoryClass: EntityEventRepository::class)]
|
||||||
#[ORM\UniqueConstraint(
|
#[ORM\UniqueConstraint(
|
||||||
columns: ['action', 'date', 'entity_id']
|
columns: ['action', 'date', 'entity_uid']
|
||||||
)]
|
)]
|
||||||
class EntityEvent extends Event
|
class EntityEvent extends Event
|
||||||
{
|
{
|
||||||
#[ORM\ManyToOne(targetEntity: Entity::class, inversedBy: 'events')]
|
#[ORM\ManyToOne(targetEntity: Entity::class, inversedBy: 'events')]
|
||||||
#[ORM\JoinColumn(referencedColumnName: 'handle', nullable: false)]
|
#[ORM\JoinColumn(name: 'entity_uid', referencedColumnName: 'id', nullable: false)]
|
||||||
private ?Entity $entity = null;
|
private ?Entity $entity = null;
|
||||||
|
|
||||||
public function getEntity(): ?Entity
|
public function getEntity(): ?Entity
|
||||||
|
|||||||
@ -19,7 +19,7 @@ class NameserverEntity
|
|||||||
|
|
||||||
#[ORM\Id]
|
#[ORM\Id]
|
||||||
#[ORM\ManyToOne(targetEntity: Entity::class, cascade: ['persist'], inversedBy: 'nameserverEntities')]
|
#[ORM\ManyToOne(targetEntity: Entity::class, cascade: ['persist'], inversedBy: 'nameserverEntities')]
|
||||||
#[ORM\JoinColumn(referencedColumnName: 'handle', nullable: false)]
|
#[ORM\JoinColumn(name: 'entity_uid', referencedColumnName: 'id', nullable: false)]
|
||||||
#[Groups(['nameserver-entity:entity'])]
|
#[Groups(['nameserver-entity:entity'])]
|
||||||
private ?Entity $entity = null;
|
private ?Entity $entity = null;
|
||||||
|
|
||||||
|
|||||||
@ -70,9 +70,16 @@ class Tld
|
|||||||
#[Groups(['tld:item'])]
|
#[Groups(['tld:item'])]
|
||||||
private ?TldType $type = null;
|
private ?TldType $type = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var Collection<int, Entity>
|
||||||
|
*/
|
||||||
|
#[ORM\OneToMany(targetEntity: Entity::class, mappedBy: 'tld')]
|
||||||
|
private Collection $entities;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->rdapServers = new ArrayCollection();
|
$this->rdapServers = new ArrayCollection();
|
||||||
|
$this->entities = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -200,4 +207,34 @@ class Tld
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Collection<int, Entity>
|
||||||
|
*/
|
||||||
|
public function getEntities(): Collection
|
||||||
|
{
|
||||||
|
return $this->entities;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addEntity(Entity $entity): static
|
||||||
|
{
|
||||||
|
if (!$this->entities->contains($entity)) {
|
||||||
|
$this->entities->add($entity);
|
||||||
|
$entity->setTld($this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeEntity(Entity $entity): static
|
||||||
|
{
|
||||||
|
if ($this->entities->removeElement($entity)) {
|
||||||
|
// set the owning side to null (unless already changed)
|
||||||
|
if ($entity->getTld() === $this) {
|
||||||
|
$entity->setTld(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -357,7 +357,7 @@ readonly class RDAPService
|
|||||||
if (isset($rdapData['entities']) && is_array($rdapData['entities'])) {
|
if (isset($rdapData['entities']) && is_array($rdapData['entities'])) {
|
||||||
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());
|
$entity = $this->registerEntity($rdapEntity, $roles, $domain->getLdhName(), $domain->getTld());
|
||||||
|
|
||||||
$domainEntity = $this->domainEntityRepository->findOneBy([
|
$domainEntity = $this->domainEntityRepository->findOneBy([
|
||||||
'domain' => $domain,
|
'domain' => $domain,
|
||||||
@ -391,7 +391,7 @@ readonly class RDAPService
|
|||||||
|
|
||||||
foreach ($rdapData['nameservers'] as $rdapNameserver) {
|
foreach ($rdapData['nameservers'] as $rdapNameserver) {
|
||||||
$nameserver = $this->fetchOrCreateNameserver($rdapNameserver, $domain);
|
$nameserver = $this->fetchOrCreateNameserver($rdapNameserver, $domain);
|
||||||
$this->updateNameserverEntities($nameserver, $rdapNameserver);
|
$this->updateNameserverEntities($nameserver, $rdapNameserver, $domain->getTld());
|
||||||
|
|
||||||
if (!$domain->getNameservers()->contains($nameserver)) {
|
if (!$domain->getNameservers()->contains($nameserver)) {
|
||||||
$domain->addNameserver($nameserver);
|
$domain->addNameserver($nameserver);
|
||||||
@ -426,7 +426,7 @@ readonly class RDAPService
|
|||||||
/**
|
/**
|
||||||
* @throws \DateMalformedStringException
|
* @throws \DateMalformedStringException
|
||||||
*/
|
*/
|
||||||
private function updateNameserverEntities(Nameserver $nameserver, array $rdapNameserver): void
|
private function updateNameserverEntities(Nameserver $nameserver, array $rdapNameserver, Tld $tld): void
|
||||||
{
|
{
|
||||||
if (!isset($rdapNameserver['entities']) || !is_array($rdapNameserver['entities'])) {
|
if (!isset($rdapNameserver['entities']) || !is_array($rdapNameserver['entities'])) {
|
||||||
return;
|
return;
|
||||||
@ -434,7 +434,7 @@ readonly class RDAPService
|
|||||||
|
|
||||||
foreach ($rdapNameserver['entities'] as $rdapEntity) {
|
foreach ($rdapNameserver['entities'] as $rdapEntity) {
|
||||||
$roles = $this->extractEntityRoles($rdapNameserver['entities'], $rdapEntity);
|
$roles = $this->extractEntityRoles($rdapNameserver['entities'], $rdapEntity);
|
||||||
$entity = $this->registerEntity($rdapEntity, $roles, $nameserver->getLdhName());
|
$entity = $this->registerEntity($rdapEntity, $roles, $nameserver->getLdhName(), $tld);
|
||||||
|
|
||||||
$nameserverEntity = $this->nameserverEntityRepository->findOneBy([
|
$nameserverEntity = $this->nameserverEntityRepository->findOneBy([
|
||||||
'nameserver' => $nameserver,
|
'nameserver' => $nameserver,
|
||||||
@ -483,7 +483,7 @@ readonly class RDAPService
|
|||||||
* @throws \DateMalformedStringException
|
* @throws \DateMalformedStringException
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
private function registerEntity(array $rdapEntity, array $roles, string $domain): Entity
|
private function registerEntity(array $rdapEntity, array $roles, string $domain, Tld $tld): Entity
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* If the RDAP server transmits the entity's IANA number, it is used as a priority to identify the entity
|
* If the RDAP server transmits the entity's IANA number, it is used as a priority to identify the entity
|
||||||
@ -513,6 +513,7 @@ readonly class RDAPService
|
|||||||
|
|
||||||
$entity = $this->entityRepository->findOneBy([
|
$entity = $this->entityRepository->findOneBy([
|
||||||
'handle' => $rdapEntity['handle'],
|
'handle' => $rdapEntity['handle'],
|
||||||
|
'tld' => is_numeric($rdapEntity['handle']) ? null : $tld,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (null === $entity) {
|
if (null === $entity) {
|
||||||
@ -523,7 +524,7 @@ readonly class RDAPService
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$entity->setHandle($rdapEntity['handle']);
|
$entity->setHandle($rdapEntity['handle'])->setTld(is_numeric($rdapEntity['handle']) ? null : $tld);
|
||||||
|
|
||||||
if (isset($rdapEntity['remarks']) && is_array($rdapEntity['remarks']) && !is_numeric($rdapEntity['handle'])) {
|
if (isset($rdapEntity['remarks']) && is_array($rdapEntity['remarks']) && !is_numeric($rdapEntity['handle'])) {
|
||||||
$entity->setRemarks($rdapEntity['remarks']);
|
$entity->setRemarks($rdapEntity['remarks']);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user