fix: update table scheme

This commit is contained in:
Maël Gangloff
2024-07-13 12:49:11 +02:00
parent 4b062a6759
commit 5faa6489b1
8 changed files with 68 additions and 15 deletions

View File

@@ -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;

View File

@@ -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]

View File

@@ -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

View File

@@ -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>
*/

View File

@@ -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()