227 lines
5.5 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\DomainRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: DomainRepository::class)]
class Domain
{
#[ORM\Id]
#[ORM\Column(length: 255)]
2024-07-11 17:01:16 +02:00
private ?string $ldhName = null;
2024-07-10 23:30:59 +02:00
2024-07-11 17:01:16 +02:00
#[ORM\Id]
2024-07-10 23:30:59 +02:00
#[ORM\Column(length: 255)]
private ?string $handle = null;
/**
2024-07-11 17:01:16 +02:00
* @var Collection<int, DomainEvent>
2024-07-10 23:30:59 +02:00
*/
2024-07-11 17:01:16 +02:00
#[ORM\OneToMany(targetEntity: DomainEvent::class, mappedBy: 'domain', orphanRemoval: true)]
2024-07-10 23:30:59 +02:00
private Collection $events;
/**
* @var Collection<int, DomainEntity>
*/
#[ORM\OneToMany(targetEntity: DomainEntity::class, mappedBy: 'domain', orphanRemoval: true)]
private Collection $domainEntities;
#[ORM\Column(length: 255)]
private ?string $whoisStatus = null;
2024-07-11 13:15:04 +02:00
#[ORM\Column(type: Types::SIMPLE_ARRAY, enumType: DomainStatus::class)]
private array $status = [];
2024-07-11 22:20:20 +02:00
/**
* @var Collection<int, BookmarkList>
*/
#[ORM\ManyToMany(targetEntity: BookmarkList::class, mappedBy: 'domains')]
private Collection $bookmarkLists;
2024-07-11 17:01:16 +02:00
/**
* @var Collection<int, Nameserver>
*/
2024-07-11 22:20:20 +02:00
#[ORM\ManyToMany(targetEntity: Nameserver::class, inversedBy: 'domains')]
#[ORM\JoinTable(name: 'domain_nameservers',
2024-07-11 22:22:59 +02:00
joinColumns: [new ORM\JoinColumn(name: 'domain_handle', referencedColumnName: 'handle'), new ORM\JoinColumn(name: 'domain_ldh_name', referencedColumnName: 'ldh_name')],
inverseJoinColumns: [new ORM\JoinColumn(name: 'nameserver_handle', referencedColumnName: 'handle')]
2024-07-11 22:20:20 +02:00
)]
2024-07-11 17:01:16 +02:00
private Collection $nameservers;
2024-07-10 23:30:59 +02:00
public function __construct()
{
$this->events = new ArrayCollection();
$this->domainEntities = new ArrayCollection();
2024-07-11 22:20:20 +02:00
$this->bookmarkLists = new ArrayCollection();
2024-07-11 17:01:16 +02:00
$this->nameservers = new ArrayCollection();
2024-07-10 23:30:59 +02:00
}
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;
}
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
* @return Collection<int, DomainEvent>
2024-07-10 23:30:59 +02:00
*/
public function getEvents(): Collection
{
return $this->events;
}
2024-07-11 17:01:16 +02:00
public function addEvent(DomainEvent $event): static
2024-07-10 23:30:59 +02:00
{
if (!$this->events->contains($event)) {
$this->events->add($event);
$event->setDomain($this);
}
return $this;
}
2024-07-11 17:01:16 +02:00
public function removeEvent(DomainEvent $event): static
2024-07-10 23:30:59 +02:00
{
if ($this->events->removeElement($event)) {
// set the owning side to null (unless already changed)
if ($event->getDomain() === $this) {
$event->setDomain(null);
}
}
return $this;
}
/**
* @return Collection<int, DomainEntity>
*/
public function getDomainEntities(): Collection
{
return $this->domainEntities;
}
public function addDomainEntity(DomainEntity $domainEntity): static
{
if (!$this->domainEntities->contains($domainEntity)) {
$this->domainEntities->add($domainEntity);
$domainEntity->setDomain($this);
}
return $this;
}
public function removeDomainEntity(DomainEntity $domainEntity): static
{
if ($this->domainEntities->removeElement($domainEntity)) {
// set the owning side to null (unless already changed)
if ($domainEntity->getDomain() === $this) {
$domainEntity->setDomain(null);
}
}
return $this;
}
public function getWhoisStatus(): ?string
{
return $this->whoisStatus;
}
public function setWhoisStatus(string $whoisStatus): static
{
$this->whoisStatus = $whoisStatus;
return $this;
}
2024-07-11 13:15:04 +02:00
/**
* @return DomainStatus[]
*/
public function getStatus(): array
{
return $this->status;
}
public function setStatus(array $status): static
{
$this->status = $status;
return $this;
}
2024-07-11 17:01:16 +02:00
2024-07-11 22:20:20 +02:00
/**
* @return Collection<int, BookmarkList>
*/
public function getBookmarkLists(): Collection
{
return $this->bookmarkLists;
}
public function addBookmarkList(BookmarkList $bookmarkList): static
{
if (!$this->bookmarkLists->contains($bookmarkList)) {
$this->bookmarkLists->add($bookmarkList);
$bookmarkList->addDomain($this);
}
return $this;
}
public function removeBookmarkList(BookmarkList $bookmarkList): static
{
if ($this->bookmarkLists->removeElement($bookmarkList)) {
$bookmarkList->removeDomain($this);
}
return $this;
}
2024-07-11 17:01:16 +02:00
/**
* @return Collection<int, Nameserver>
*/
public function getNameservers(): Collection
{
return $this->nameservers;
}
public function addNameserver(Nameserver $nameserver): static
{
if (!$this->nameservers->contains($nameserver)) {
$this->nameservers->add($nameserver);
}
return $this;
}
public function removeNameserver(Nameserver $nameserver): static
{
$this->nameservers->removeElement($nameserver);
return $this;
}
2024-07-10 23:30:59 +02:00
}