mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
fix: update table scheme
This commit is contained in:
@@ -54,7 +54,7 @@ class TestController extends AbstractController
|
||||
'GET', $rdapServer . 'domain/' . $fqdn
|
||||
)->toArray();
|
||||
|
||||
$domain = $this->domainRepository->findOneBy(["handle" => $res['handle']]);
|
||||
$domain = $this->domainRepository->findOneBy(["ldhName" => strtolower($res['ldhName'])]);
|
||||
if ($domain === null) $domain = new Domain();
|
||||
|
||||
$domain
|
||||
@@ -109,6 +109,7 @@ class TestController extends AbstractController
|
||||
if ($nameserver === null) $nameserver = new Nameserver();
|
||||
|
||||
$nameserver->setLdhName($rdapNameserver['ldhName']);
|
||||
if (array_key_exists('handle', $rdapNameserver)) $nameserver->setHandle($rdapNameserver['handle']);
|
||||
|
||||
if (!array_key_exists('entities', $rdapNameserver)) {
|
||||
$domain->addNameserver($nameserver);
|
||||
|
||||
@@ -12,10 +12,10 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
#[ORM\Entity(repositoryClass: DomainRepository::class)]
|
||||
class Domain
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $ldhName = null;
|
||||
|
||||
#[ORM\Id]
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $handle = null;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class DomainEntity
|
||||
{
|
||||
#[ORM\Id]
|
||||
#[ORM\ManyToOne(targetEntity: Domain::class, cascade: ['persist'], inversedBy: 'domainEntities')]
|
||||
#[ORM\JoinColumn(referencedColumnName: 'handle', nullable: false)]
|
||||
#[ORM\JoinColumn(referencedColumnName: 'ldh_name', nullable: false)]
|
||||
private ?Domain $domain = null;
|
||||
|
||||
#[ORM\Id]
|
||||
|
||||
@@ -9,7 +9,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||
class DomainEvent extends Event
|
||||
{
|
||||
#[ORM\ManyToOne(targetEntity: Domain::class, cascade: ['persist'], inversedBy: 'events')]
|
||||
#[ORM\JoinColumn(referencedColumnName: 'handle', nullable: false)]
|
||||
#[ORM\JoinColumn(referencedColumnName: 'ldh_name', nullable: false)]
|
||||
private ?Domain $domain = null;
|
||||
|
||||
public function getDomain(): ?Domain
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Config\DomainStatus;
|
||||
use App\Repository\NameserverRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
#[ORM\Entity(repositoryClass: NameserverRepository::class)]
|
||||
@@ -17,6 +15,9 @@ class Nameserver
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $ldhName = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $handle = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, NameserverEntity>
|
||||
*/
|
||||
@@ -47,6 +48,18 @@ class Nameserver
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getHandle(): ?string
|
||||
{
|
||||
return $this->handle;
|
||||
}
|
||||
|
||||
public function setHandle(string $handle): static
|
||||
{
|
||||
$this->handle = $handle;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, NameserverEntity>
|
||||
*/
|
||||
|
||||
@@ -25,7 +25,7 @@ class WatchList
|
||||
#[ORM\ManyToMany(targetEntity: Domain::class, inversedBy: 'watchLists')]
|
||||
#[ORM\JoinTable(name: 'watch_lists_domains',
|
||||
joinColumns: [new ORM\JoinColumn(name: 'watch_list_token', referencedColumnName: 'token')],
|
||||
inverseJoinColumns: [new ORM\JoinColumn(name: 'domain_handle', referencedColumnName: 'handle')])]
|
||||
inverseJoinColumns: [new ORM\JoinColumn(name: 'domain_ldh_name', referencedColumnName: 'ldh_name')])]
|
||||
private Collection $domains;
|
||||
|
||||
public function __construct()
|
||||
|
||||
Reference in New Issue
Block a user