'[]'])] private array $label = []; /** * @var \Doctrine\Common\Collections\Collection */ #[ORM\ManyToMany(targetEntity: User::class)] #[ORM\JoinTable(name: 'chill_main_user_group_user')] private Collection $users; #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => '#ffffffff'])] private string $backgroundColor = '#ffffffff'; #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => '#000000ff'])] private string $foregroundColor = '#000000ff'; /** * Groups with same exclude key are mutually exclusive: adding one in a many-to-one relationship * will exclude others. * * An empty string means "no exclusion" */ #[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: false, options: ['default' => ''])] private string $excludeKey = ''; public function __construct() { $this->users = new ArrayCollection(); } public function addUser(User $user): self { if (!$this->users->contains($user)) { $this->users[] = $user; } return $this; } public function removeUser(User $user): self { if ($this->users->contains($user)) { $this->users->removeElement($user); } return $this; } public function getId(): ?int { return $this->id; } public function getLabel(): array { return $this->label; } public function getUsers(): Collection { return $this->users; } public function getForegroundColor(): string { return $this->foregroundColor; } public function getExcludeKey(): string { return $this->excludeKey; } public function getBackgroundColor(): string { return $this->backgroundColor; } public function setForegroundColor(string $foregroundColor): self { $this->foregroundColor = $foregroundColor; return $this; } public function setBackgroundColor(string $backgroundColor): self { $this->backgroundColor = $backgroundColor; return $this; } public function setExcludeKey(string $excludeKey): self { $this->excludeKey = $excludeKey; return $this; } public function setLabel(array $label): self { $this->label = $label; return $this; } /** * Checks if the current object is an instance of the UserGroup class. * * In use in twig template, to discriminate when there an object can be polymorphic. * * @return bool returns true if the current object is an instance of UserGroup, false otherwise */ public function isUserGroup(): bool { return true; } }