145 lines
3.6 KiB
PHP
Raw Normal View History

2024-07-10 23:30:59 +02:00
<?php
namespace App\Entity;
use App\Repository\EntityRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: EntityRepository::class)]
class Entity
{
#[ORM\Id]
#[ORM\Column(length: 255)]
private ?string $handle = null;
/**
* @var Collection<int, DomainEntity>
*/
#[ORM\OneToMany(targetEntity: DomainEntity::class, mappedBy: 'entity', orphanRemoval: true)]
private Collection $domainEntities;
/**
* @var Collection<int, NameserverEntity>
*/
#[ORM\OneToMany(targetEntity: NameserverEntity::class, mappedBy: 'entity')]
private Collection $nameserverEntities;
2024-07-11 18:29:22 +02:00
/**
* @var Collection<int, Event>
*/
#[ORM\OneToMany(targetEntity: Event::class, mappedBy: 'entity', orphanRemoval: true)]
private Collection $events;
2024-07-10 23:30:59 +02:00
public function __construct()
{
$this->domainEntities = new ArrayCollection();
$this->nameserverEntities = new ArrayCollection();
2024-07-11 18:29:22 +02:00
$this->events = new ArrayCollection();
2024-07-10 23:30:59 +02:00
}
public function getHandle(): ?string
{
return $this->handle;
}
public function setHandle(string $handle): static
{
$this->handle = $handle;
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->setEntity($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->getEntity() === $this) {
$domainEntity->setEntity(null);
}
}
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->setEntity($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->getEntity() === $this) {
$nameserverEntity->setEntity(null);
}
}
return $this;
}
2024-07-11 18:29:22 +02:00
/**
* @return Collection<int, Event>
*/
public function getEvents(): Collection
{
return $this->events;
}
public function addEvent(Event $event): static
{
if (!$this->events->contains($event)) {
$this->events->add($event);
$event->setEntity($this);
}
return $this;
}
public function removeEvent(Event $event): static
{
if ($this->events->removeElement($event)) {
// set the owning side to null (unless already changed)
if ($event->getEntity() === $this) {
$event->setEntity(null);
}
}
return $this;
}
2024-07-10 23:30:59 +02:00
}