true])] #[Assert\NotNull] #[Serializer\Expose] #[Serializer\Groups(['Default'])] private bool $visible = true; use ColorTrait; /** * @var Collection */ #[ORM\ManyToMany(targetEntity: Timesheet::class, mappedBy: 'tags', fetch: 'EXTRA_LAZY')] private Collection $timesheets; public function __construct() { $this->timesheets = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function setName(?string $tagName): Tag { $this->name = $tagName; return $this; } public function getName(): ?string { return $this->name; } public function isVisible(): bool { return $this->visible; } public function setVisible(bool $visible): void { $this->visible = $visible; } public function addTimesheet(Timesheet $timesheet): void { if ($this->timesheets->contains($timesheet)) { return; } $this->timesheets->add($timesheet); $timesheet->addTag($this); } public function removeTimesheet(Timesheet $timesheet): void { if (!$this->timesheets->contains($timesheet)) { return; } $this->timesheets->removeElement($timesheet); $timesheet->removeTag($this); } public function __toString(): string { return $this->getName(); } }