*/ #[ORM\ManyToMany(targetEntity: Snip::class, inversedBy: 'tags')] private Collection $snips; public function __construct() { $this->snips = new ArrayCollection(); } public function __toString(): string { return $this->name ?? ''; } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): static { $this->name = $name; return $this; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): static { $this->user = $user; return $this; } /** * @return Collection */ public function getSnips(): Collection { return $this->snips; } public function addSnip(Snip $snip): static { if (!$this->snips->contains($snip)) { $this->snips->add($snip); } return $this; } public function removeSnip(Snip $snip): static { $this->snips->removeElement($snip); return $this; } }