*/ #[ORM\OneToMany(mappedBy: 'parent', targetEntity: EventTheme::class)] private Collection $children; #[ORM\ManyToOne(targetEntity: EventTheme::class, inversedBy: 'children')] private ?EventTheme $parent = null; #[ORM\Column(name: 'ordering', type: Types::FLOAT, options: ['default' => '0.0'])] private float $ordering = 0.0; /** * Constructor. */ public function __construct() { $this->children = new ArrayCollection(); } /** * Get active. */ public function getIsActive(): bool { return $this->isActive; } /** * Get id. */ public function getId(): ?int { return $this->id; } /** * Get label. */ public function getName(): array { return $this->name; } /** * Set active. * * @return EventTheme */ public function setIsActive(bool $active): static { $this->isActive = $active; return $this; } /** * Set label. * * @return EventTheme */ public function setName(array $label): static { $this->name = $label; return $this; } public function addChild(self $child): self { if (!$this->children->contains($child)) { $this->children[] = $child; } return $this; } public function removeChild(self $child): self { if ($this->children->removeElement($child)) { // set the owning side to null (unless already changed) if ($child->getParent() === $this) { $child->setParent(null); } } return $this; } public function getChildren(): Collection { return $this->children; } public function getDescendants(): Collection { $descendants = new ArrayCollection(); foreach ($this->getChildren() as $child) { if (!$descendants->contains($child)) { $descendants->add($child); foreach ($child->getDescendants() as $descendantsOfChild) { if (!$descendants->contains($descendantsOfChild)) { $descendants->add($descendantsOfChild); } } } } return $descendants; } public function hasParent(): bool { return null !== $this->parent; } public function getOrdering(): float { return $this->ordering; } public function setOrdering(float $ordering): EventTheme { $this->ordering = $ordering; return $this; } public function getParent(): ?self { return $this->parent; } public function setParent(?self $parent): self { $this->parent = $parent; $parent?->addChild($this); return $this; } }