mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
fix: entity handle can be an empty string
This commit is contained in:
15
assets/controllers.json
Normal file
15
assets/controllers.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"controllers": {
|
||||
"@symfony/ux-turbo": {
|
||||
"turbo-core": {
|
||||
"enabled": true,
|
||||
"fetch": "eager"
|
||||
},
|
||||
"mercure-turbo-stream": {
|
||||
"enabled": false,
|
||||
"fetch": "eager"
|
||||
}
|
||||
}
|
||||
},
|
||||
"entrypoints": []
|
||||
}
|
||||
@@ -15,6 +15,7 @@ use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
|
||||
use Symfony\Component\Serializer\Attribute\Groups;
|
||||
use Symfony\Component\Serializer\Attribute\SerializedName;
|
||||
|
||||
#[ORM\Entity(repositoryClass: DomainRepository::class)]
|
||||
#[UniqueEntity('handle')]
|
||||
@@ -68,6 +69,7 @@ class Domain
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: DomainEntity::class, mappedBy: 'domain', cascade: ['persist'], orphanRemoval: true)]
|
||||
#[Groups(['domain:item'])]
|
||||
#[SerializedName('entities')]
|
||||
private Collection $domainEntities;
|
||||
|
||||
#[ORM\Column(type: Types::SIMPLE_ARRAY)]
|
||||
|
||||
@@ -12,6 +12,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Attribute\Groups;
|
||||
use Symfony\Component\Serializer\Attribute\SerializedName;
|
||||
|
||||
#[ORM\Entity(repositoryClass: EntityRepository::class)]
|
||||
#[ApiFilter(SearchFilter::class, properties: ['jCard' => 'partial'])]
|
||||
@@ -50,6 +51,7 @@ class Entity
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: DomainEntity::class, mappedBy: 'entity', orphanRemoval: true)]
|
||||
#[Groups(['entity:item'])]
|
||||
#[SerializedName('domains')]
|
||||
private Collection $domainEntities;
|
||||
|
||||
/**
|
||||
@@ -57,6 +59,7 @@ class Entity
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: NameserverEntity::class, mappedBy: 'entity')]
|
||||
#[Groups(['entity:item'])]
|
||||
#[SerializedName('nameservers')]
|
||||
private Collection $nameserverEntities;
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Serializer\Attribute\Groups;
|
||||
use Symfony\Component\Serializer\Attribute\SerializedName;
|
||||
|
||||
#[ORM\Entity(repositoryClass: NameserverRepository::class)]
|
||||
#[ApiResource(
|
||||
@@ -49,6 +50,7 @@ class Nameserver
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: NameserverEntity::class, mappedBy: 'nameserver', cascade: ['persist'], orphanRemoval: true)]
|
||||
#[Groups(['nameserver:item', 'domain:item'])]
|
||||
#[SerializedName('entities')]
|
||||
private Collection $nameserverEntities;
|
||||
|
||||
/**
|
||||
|
||||
@@ -113,7 +113,7 @@ readonly class RDAPService
|
||||
}
|
||||
|
||||
foreach ($res['entities'] as $rdapEntity) {
|
||||
if (!array_key_exists('handle', $rdapEntity)) continue;
|
||||
if (!array_key_exists('handle', $rdapEntity) || $rdapEntity['handle'] === '') continue;
|
||||
$entity = $this->registerEntity($rdapEntity);
|
||||
|
||||
$this->em->persist($entity);
|
||||
@@ -151,7 +151,7 @@ readonly class RDAPService
|
||||
}
|
||||
|
||||
foreach ($rdapNameserver['entities'] as $rdapEntity) {
|
||||
if (!array_key_exists('handle', $rdapEntity)) continue;
|
||||
if (!array_key_exists('handle', $rdapEntity) || $rdapEntity['handle'] === '') continue;
|
||||
$entity = $this->registerEntity($rdapEntity);
|
||||
|
||||
$this->em->persist($entity);
|
||||
|
||||
Reference in New Issue
Block a user