Files
domain-watchdog/src/Entity/Nameserver.php

106 lines
2.4 KiB
PHP
Raw Normal View History

2024-07-10 23:30:59 +02:00
<?php
namespace App\Entity;
2024-07-11 13:15:04 +02:00
use App\Config\DomainStatus;
2024-07-10 23:30:59 +02:00
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)]
class Nameserver
{
#[ORM\Id]
#[ORM\Column(length: 255)]
private ?string $handle = null;
#[ORM\Column(length: 255)]
2024-07-11 17:01:16 +02:00
private ?string $ldhName = null;
2024-07-10 23:30:59 +02:00
/**
* @var Collection<int, NameserverEntity>
*/
#[ORM\OneToMany(targetEntity: NameserverEntity::class, mappedBy: 'nameserver', orphanRemoval: true)]
private Collection $nameserverEntities;
2024-07-11 13:15:04 +02:00
#[ORM\Column(type: Types::SIMPLE_ARRAY, enumType: DomainStatus::class)]
2024-07-10 23:30:59 +02:00
private array $status = [];
public function __construct()
{
$this->nameserverEntities = new ArrayCollection();
}
public function getHandle(): ?string
{
return $this->handle;
}
public function setHandle(string $handle): static
{
$this->handle = $handle;
return $this;
}
2024-07-11 17:01:16 +02:00
public function getLdhName(): ?string
2024-07-10 23:30:59 +02:00
{
2024-07-11 17:01:16 +02:00
return $this->ldhName;
2024-07-10 23:30:59 +02:00
}
2024-07-11 17:01:16 +02:00
public function setLdhName(string $ldhName): static
2024-07-10 23:30:59 +02:00
{
2024-07-11 17:01:16 +02:00
$this->ldhName = $ldhName;
2024-07-10 23:30:59 +02:00
return $this;
}
/**
* @return Collection<int, NameserverEntity>
*/
public function getNameserverEntities(): Collection
{
return $this->nameserverEntities;
}
public function addNameserverEntity(NameserverEntity $nameserverEntity): static
{
if (!$this->nameserverEntities->contains($nameserverEntity)) {
$this->nameserverEntities->add($nameserverEntity);
$nameserverEntity->setNameserver($this);
}
return $this;
}
public function removeNameserverEntity(NameserverEntity $nameserverEntity): static
{
if ($this->nameserverEntities->removeElement($nameserverEntity)) {
// set the owning side to null (unless already changed)
if ($nameserverEntity->getNameserver() === $this) {
$nameserverEntity->setNameserver(null);
}
}
return $this;
}
2024-07-11 13:15:04 +02:00
/**
* @return DomainStatus[]
*/
2024-07-10 23:30:59 +02:00
public function getStatus(): array
{
return $this->status;
}
public function setStatus(array $status): static
{
$this->status = $status;
return $this;
}
2024-07-11 13:15:04 +02:00
2024-07-10 23:30:59 +02:00
}