['user:read']], security: "is_granted('ROLE_USER')", provider: MeProvider::class ), new Get( requirements: ['id' => '\d+'], normalizationContext: ['groups' => ['user:read']], security: "is_granted('ROLE_USER')" ), new GetCollection( normalizationContext: ['groups' => ['user:read']], security: "is_granted('PUBLIC_ACCESS')" ), ], normalizationContext: ['groups' => ['user:read']], paginationEnabled: false )] class User implements UserInterface, PasswordAuthenticatedUserInterface { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column(type: 'integer')] #[Groups(['user:read', 'reception:read'])] private ?int $id = null; #[ORM\Column(length: 180, unique: true)] #[Groups(['user:read', 'reception:read'])] private string $username = ''; #[ORM\Column(type: 'json')] private array $roles = []; #[ORM\Column] private string $password = ''; public function getId(): ?int { return $this->id; } public function getUsername(): string { return $this->username; } public function setUsername(string $username): self { $this->username = $username; return $this; } public function getUserIdentifier(): string { return $this->username; } public function getRoles(): array { $roles = $this->roles; $roles[] = 'ROLE_USER'; return array_unique($roles); } public function setRoles(array $roles): self { $this->roles = $roles; return $this; } public function getPassword(): string { return $this->password; } public function setPassword(string $password): self { $this->password = $password; return $this; } public function eraseCredentials(): void { // No-op: we don't store temporary sensitive data on the entity. } }