true])] #[Assert\NotNull] #[Serializer\Expose] #[Serializer\Groups(['Default'])] private bool $visible = true; use ColorTrait; public function __construct() { } public function getId(): ?int { return $this->id; } public function setName(?string $tagName): Tag { $this->name = $tagName !== null ? trim($tagName) : $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 __toString(): string { return $this->getName(); } public function getColorSafe(): string { return $this->getColor() ?? (new Color())->getRandom($this->getName()); } }