Equipment::class, 'intangible' => Intangible::class, ] )] abstract class AbstractProduct { #[ORM\Id] #[ORM\Column] #[ORM\GeneratedValue] protected ?int $id = null; #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'products', cascade: ['persist'], orphanRemoval: false)] protected Collection $tags; public function __construct() { $this->tags = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getTags(): Collection { return $this->tags; } public function addTag(Tagg $tag): self { if (!$this->tags->contains($tag)) { $this->tags[] = $tag; $tag->addProduct($this); } return $this; } public function removeTag(Tagg $tag): self { if ($this->tags->removeElement($tag)) { $tag->removeProduct($this); } return $this; } }