UserGroup::class])] class UserGroup { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER, nullable: false)] #[Serializer\Groups(['read'])] private ?int $id = null; #[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON, nullable: false, options: ['default' => '[]'])] #[Serializer\Groups(['read'])] private array $label = []; /** * @var \Doctrine\Common\Collections\Collection */ #[ORM\ManyToMany(targetEntity: User::class)] #[ORM\JoinTable(name: 'chill_main_user_group_user')] private Collection $users; 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; } }