$items */ #[ORM\OneToMany(mappedBy: 'menu', targetEntity: MenuItem::class, cascade: ['persist', 'remove', 'detach'])] private Collection $items; public function __construct() { $this->items = new ArrayCollection(); } public function __toString(): string { return $this->code; } public function getId(): int { return $this->id; } public function setId(int $id): self { $this->id = $id; return $this; } public function getLogo(): ?string { return $this->logo; } public function setLogo(?string $logo): self { $this->logo = $logo; return $this; } public function getCode(): string { return $this->code; } public function setCode(string $code): self { $this->code = $code; return $this; } public function getImage(): ?string { return $this->getLogo(); } /** * @return Collection */ public function getItems(): Collection { return $this->items; } /** * @param Collection $items */ public function setItems(Collection $items): self { $this->items = $items; return $this; } public function addItem(MenuItem $item): self { if (!$this->items->contains($item)) { $this->items->add($item); $item->setMenu($this); } return $this; } public function removeItem(MenuItem $item): self { $this->items->removeElement($item); // if ($this->items->removeElement($item)) { // set the owning side to null (unless already changed) // if ($item->getMenu() === $this) { // $item->setMenu(null); // } // } return $this; } public function itemsCount(): int { return $this->items->count(); } }