'\d+'], normalizationContext: ['groups' => ['building:read']], ), new GetCollection( normalizationContext: ['groups' => ['building:read']], ), ], security: "is_granted('ROLE_USER')", )] class Building { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] #[Groups(['building:read', 'reception:read'])] private ?int $id = null; #[ORM\Column(length: 120)] #[Groups(['building:read', 'reception:read'])] private string $label = ''; #[ORM\Column(length: 50)] #[Groups(['building:read', 'reception:read'])] private string $code = ''; /** * @var Collection */ #[ORM\ManyToMany(targetEntity: Reception::class, mappedBy: 'buildings')] private Collection $receptions; public function __construct() { $this->receptions = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getLabel(): string { return $this->label; } public function setLabel(string $label): self { $this->label = $label; return $this; } public function getCode(): string { return $this->code; } public function setCode(string $code): self { $this->code = $code; return $this; } /** * @return Collection */ public function getReceptions(): Collection { return $this->receptions; } }