mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: add groups on properties
This commit is contained in:
@@ -87,13 +87,15 @@ class Entity
|
|||||||
private ?array $remarks = null;
|
private ?array $remarks = null;
|
||||||
|
|
||||||
#[Embedded(class: IanaAccreditation::class, columnPrefix: 'iana_')]
|
#[Embedded(class: IanaAccreditation::class, columnPrefix: 'iana_')]
|
||||||
private ?IanaAccreditation $ianaAccreditation;
|
#[Groups(['entity:item', 'domain:item'])]
|
||||||
|
private IanaAccreditation $ianaAccreditation;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->domainEntities = new ArrayCollection();
|
$this->domainEntities = new ArrayCollection();
|
||||||
$this->nameserverEntities = new ArrayCollection();
|
$this->nameserverEntities = new ArrayCollection();
|
||||||
$this->events = new ArrayCollection();
|
$this->events = new ArrayCollection();
|
||||||
|
$this->ianaAccreditation = new IanaAccreditation();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getHandle(): ?string
|
public function getHandle(): ?string
|
||||||
@@ -246,12 +248,12 @@ class Entity
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIanaAccreditation(): ?IanaAccreditation
|
public function getIanaAccreditation(): IanaAccreditation
|
||||||
{
|
{
|
||||||
return $this->ianaAccreditation;
|
return $this->ianaAccreditation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setIanaAccreditation(?IanaAccreditation $ianaAccreditation): void
|
public function setIanaAccreditation(IanaAccreditation $ianaAccreditation): void
|
||||||
{
|
{
|
||||||
$this->ianaAccreditation = $ianaAccreditation;
|
$this->ianaAccreditation = $ianaAccreditation;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,23 +6,29 @@ use App\Config\RegistrarStatus;
|
|||||||
use Doctrine\DBAL\Types\Types;
|
use Doctrine\DBAL\Types\Types;
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
use Doctrine\ORM\Mapping as ORM;
|
||||||
use Doctrine\ORM\Mapping\Embeddable;
|
use Doctrine\ORM\Mapping\Embeddable;
|
||||||
|
use Symfony\Component\Serializer\Attribute\Groups;
|
||||||
|
|
||||||
#[Embeddable]
|
#[Embeddable]
|
||||||
class IanaAccreditation
|
class IanaAccreditation
|
||||||
{
|
{
|
||||||
#[ORM\Column(length: 255, nullable: true)]
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
#[Groups(['entity:item', 'domain:item'])]
|
||||||
private ?string $registrarName = null;
|
private ?string $registrarName = null;
|
||||||
|
|
||||||
#[ORM\Column(length: 255, nullable: true)]
|
#[ORM\Column(length: 255, nullable: true)]
|
||||||
|
#[Groups(['entity:item', 'domain:item'])]
|
||||||
private ?string $rdapBaseUrl = null;
|
private ?string $rdapBaseUrl = null;
|
||||||
|
|
||||||
#[ORM\Column(nullable: true, enumType: RegistrarStatus::class)]
|
#[ORM\Column(nullable: true, enumType: RegistrarStatus::class)]
|
||||||
|
#[Groups(['entity:item', 'domain:item'])]
|
||||||
private ?RegistrarStatus $status = null;
|
private ?RegistrarStatus $status = null;
|
||||||
|
|
||||||
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
|
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
|
||||||
|
#[Groups(['entity:item', 'domain:item'])]
|
||||||
private ?\DateTimeImmutable $updated = null;
|
private ?\DateTimeImmutable $updated = null;
|
||||||
|
|
||||||
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
|
#[ORM\Column(type: Types::DATE_IMMUTABLE, nullable: true)]
|
||||||
|
#[Groups(['entity:item', 'domain:item'])]
|
||||||
private ?\DateTimeImmutable $date = null;
|
private ?\DateTimeImmutable $date = null;
|
||||||
|
|
||||||
public function getRegistrarName(): ?string
|
public function getRegistrarName(): ?string
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ use App\Entity\DomainEvent;
|
|||||||
use App\Entity\DomainStatus;
|
use App\Entity\DomainStatus;
|
||||||
use App\Entity\Entity;
|
use App\Entity\Entity;
|
||||||
use App\Entity\EntityEvent;
|
use App\Entity\EntityEvent;
|
||||||
use App\Entity\IanaAccreditation;
|
|
||||||
use App\Entity\Nameserver;
|
use App\Entity\Nameserver;
|
||||||
use App\Entity\NameserverEntity;
|
use App\Entity\NameserverEntity;
|
||||||
use App\Entity\RdapServer;
|
use App\Entity\RdapServer;
|
||||||
@@ -568,11 +567,11 @@ readonly class RDAPService
|
|||||||
|
|
||||||
$entity->setHandle($rdapEntity['handle']);
|
$entity->setHandle($rdapEntity['handle']);
|
||||||
|
|
||||||
if (isset($rdapEntity['remarks']) && is_array($rdapEntity['remarks']) && null === $entity->getIanaAccreditation()) {
|
if (isset($rdapEntity['remarks']) && is_array($rdapEntity['remarks']) && null === $entity->getIanaAccreditation()->getStatus()) {
|
||||||
$entity->setRemarks($rdapEntity['remarks']);
|
$entity->setRemarks($rdapEntity['remarks']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($rdapEntity['vcardArray']) && null === $entity->getIanaAccreditation()) {
|
if (isset($rdapEntity['vcardArray']) && null === $entity->getIanaAccreditation()->getStatus()) {
|
||||||
if (empty($entity->getJCard())) {
|
if (empty($entity->getJCard())) {
|
||||||
if (!array_key_exists('elements', $rdapEntity['vcardArray'])) {
|
if (!array_key_exists('elements', $rdapEntity['vcardArray'])) {
|
||||||
$entity->setJCard($rdapEntity['vcardArray']);
|
$entity->setJCard($rdapEntity['vcardArray']);
|
||||||
@@ -606,7 +605,7 @@ readonly class RDAPService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($isIANAid || !isset($rdapEntity['events']) || null !== $entity->getIanaAccreditation()) {
|
if ($isIANAid || !isset($rdapEntity['events']) || null !== $entity->getIanaAccreditation()->getStatus()) {
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -826,17 +825,13 @@ readonly class RDAPService
|
|||||||
->setHandle($registrar->value)
|
->setHandle($registrar->value)
|
||||||
->setTld(null)
|
->setTld(null)
|
||||||
->setJCard(['vcard', [['version', [], 'text', '4.0'], ['fn', [], 'text', $registrar->name]]])
|
->setJCard(['vcard', [['version', [], 'text', '4.0'], ['fn', [], 'text', $registrar->name]]])
|
||||||
->setRemarks(null);
|
->setRemarks(null)
|
||||||
|
->getIanaAccreditation()
|
||||||
if (null === $entity->getIanaAccreditation()) {
|
->setRegistrarName($registrar->name)
|
||||||
$entity->setIanaAccreditation(new IanaAccreditation());
|
->setStatus(RegistrarStatus::from($registrar->status))
|
||||||
}
|
->setRdapBaseUrl($registrar->rdapurl->count() ? ($registrar->rdapurl->server) : null)
|
||||||
$entity->getIanaAccreditation()
|
->setUpdated(null !== $registrar->attributes()->updated ? new \DateTimeImmutable($registrar->attributes()->updated) : null)
|
||||||
->setRegistrarName($registrar->name)
|
->setDate(null !== $registrar->attributes()->date ? new \DateTimeImmutable($registrar->attributes()->date) : null);
|
||||||
->setStatus(RegistrarStatus::from($registrar->status))
|
|
||||||
->setRdapBaseUrl($registrar->rdapurl->count() ? ($registrar->rdapurl->server) : null)
|
|
||||||
->setUpdated(null !== $registrar->attributes()->updated ? new \DateTimeImmutable($registrar->attributes()->updated) : null)
|
|
||||||
->setDate(null !== $registrar->attributes()->date ? new \DateTimeImmutable($registrar->attributes()->date) : null);
|
|
||||||
|
|
||||||
$this->em->persist($entity);
|
$this->em->persist($entity);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user