feat: add id column on entity

This commit is contained in:
Maël Gangloff
2025-02-18 01:29:29 +01:00
parent e7b8ce612e
commit 89a7daf882
9 changed files with 264 additions and 12 deletions

View File

@@ -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;
}
}