mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: add id column on entity
This commit is contained in:
@@ -70,9 +70,16 @@ class Tld
|
||||
#[Groups(['tld:item'])]
|
||||
private ?TldType $type = null;
|
||||
|
||||
/**
|
||||
* @var Collection<int, Entity>
|
||||
*/
|
||||
#[ORM\OneToMany(targetEntity: Entity::class, mappedBy: 'tld')]
|
||||
private Collection $entities;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->rdapServers = new ArrayCollection();
|
||||
$this->entities = new ArrayCollection();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -200,4 +207,34 @@ class Tld
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection<int, Entity>
|
||||
*/
|
||||
public function getEntities(): Collection
|
||||
{
|
||||
return $this->entities;
|
||||
}
|
||||
|
||||
public function addEntity(Entity $entity): static
|
||||
{
|
||||
if (!$this->entities->contains($entity)) {
|
||||
$this->entities->add($entity);
|
||||
$entity->setTld($this);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function removeEntity(Entity $entity): static
|
||||
{
|
||||
if ($this->entities->removeElement($entity)) {
|
||||
// set the owning side to null (unless already changed)
|
||||
if ($entity->getTld() === $this) {
|
||||
$entity->setTld(null);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user