mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: add enum
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Config\DomainStatus;
|
||||
use App\Repository\DomainRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
@@ -18,9 +19,6 @@ class Domain
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $handle = null;
|
||||
|
||||
#[ORM\Column(type: Types::SIMPLE_ARRAY)]
|
||||
private array $status = [];
|
||||
|
||||
/**
|
||||
* @var Collection<int, Event>
|
||||
*/
|
||||
@@ -36,6 +34,9 @@ class Domain
|
||||
#[ORM\Column(length: 255)]
|
||||
private ?string $whoisStatus = null;
|
||||
|
||||
#[ORM\Column(type: Types::SIMPLE_ARRAY, enumType: DomainStatus::class)]
|
||||
private array $status = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->events = new ArrayCollection();
|
||||
@@ -66,18 +67,6 @@ class Domain
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getStatus(): array
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function setStatus(array $status): static
|
||||
{
|
||||
$this->status = $status;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Event>
|
||||
*/
|
||||
@@ -149,4 +138,19 @@ class Domain
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DomainStatus[]
|
||||
*/
|
||||
public function getStatus(): array
|
||||
{
|
||||
return $this->status;
|
||||
}
|
||||
|
||||
public function setStatus(array $status): static
|
||||
{
|
||||
$this->status = $status;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Config\DomainRole;
|
||||
use App\Repository\DomainEntityRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
@@ -19,9 +20,10 @@ class DomainEntity
|
||||
#[ORM\JoinColumn(referencedColumnName: 'handle', nullable: false)]
|
||||
private ?Entity $entity = null;
|
||||
|
||||
#[ORM\Column(type: Types::SIMPLE_ARRAY)]
|
||||
#[ORM\Column(type: Types::SIMPLE_ARRAY, enumType: DomainRole::class)]
|
||||
private array $roles = [];
|
||||
|
||||
|
||||
public function getDomain(): ?Domain
|
||||
{
|
||||
return $this->domain;
|
||||
@@ -46,7 +48,10 @@ class DomainEntity
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRoles(): ?array
|
||||
/**
|
||||
* @return DomainRole[]
|
||||
*/
|
||||
public function getRoles(): array
|
||||
{
|
||||
return $this->roles;
|
||||
}
|
||||
@@ -57,4 +62,5 @@ class DomainEntity
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Config\DomainStatus;
|
||||
use App\Repository\NameserverRepository;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
@@ -24,7 +25,7 @@ class Nameserver
|
||||
#[ORM\OneToMany(targetEntity: NameserverEntity::class, mappedBy: 'nameserver', orphanRemoval: true)]
|
||||
private Collection $nameserverEntities;
|
||||
|
||||
#[ORM\Column(type: Types::ARRAY)]
|
||||
#[ORM\Column(type: Types::SIMPLE_ARRAY, enumType: DomainStatus::class)]
|
||||
private array $status = [];
|
||||
|
||||
public function __construct()
|
||||
@@ -86,6 +87,9 @@ class Nameserver
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DomainStatus[]
|
||||
*/
|
||||
public function getStatus(): array
|
||||
{
|
||||
return $this->status;
|
||||
@@ -97,4 +101,5 @@ class Nameserver
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Config\DomainRole;
|
||||
use App\Config\DomainStatus;
|
||||
use App\Repository\NameserverEntityRepository;
|
||||
use Doctrine\DBAL\Types\Types;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
@@ -19,10 +21,10 @@ class NameserverEntity
|
||||
#[ORM\JoinColumn(referencedColumnName: 'handle', nullable: false)]
|
||||
private ?Entity $entity = null;
|
||||
|
||||
#[ORM\Column(type: Types::SIMPLE_ARRAY)]
|
||||
#[ORM\Column(type: Types::SIMPLE_ARRAY, enumType: DomainRole::class)]
|
||||
private array $roles = [];
|
||||
|
||||
#[ORM\Column(type: Types::SIMPLE_ARRAY)]
|
||||
#[ORM\Column(type: Types::SIMPLE_ARRAY, enumType: DomainStatus::class)]
|
||||
private array $status = [];
|
||||
|
||||
public function getNameserver(): ?Nameserver
|
||||
@@ -49,6 +51,9 @@ class NameserverEntity
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DomainRole[]
|
||||
*/
|
||||
public function getRoles(): array
|
||||
{
|
||||
return $this->roles;
|
||||
@@ -61,6 +66,9 @@ class NameserverEntity
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DomainStatus[]
|
||||
*/
|
||||
public function getStatus(): array
|
||||
{
|
||||
return $this->status;
|
||||
@@ -72,4 +80,5 @@ class NameserverEntity
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user