'ipartial', 'code' => 'ipartial', ])] #[ApiFilter(BooleanFilter::class, properties: ['display'])] #[ApiResource( operations: [ new Get( requirements: ['id' => '\d+'], normalizationContext: ['groups' => ['bovine-type:read']], ), new GetCollection( normalizationContext: ['groups' => ['bovine-type:read']], ), new Post( normalizationContext: ['groups' => ['bovine-type:read']], denormalizationContext: ['groups' => ['bovine-type:write']], security: "is_granted('ROLE_ADMIN')", ), new Patch( requirements: ['id' => '\d+'], normalizationContext: ['groups' => ['bovine-type:read']], denormalizationContext: ['groups' => ['bovine-type:write']], security: "is_granted('ROLE_ADMIN')", ), ], security: "is_granted('ROLE_USER')", )] class BovineType { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] #[Groups(['bovine-type:read', 'reception:read', 'reception-bovine:read'])] private ?int $id = null; #[ORM\Column(length: 120)] #[Groups(['bovine-type:read', 'bovine-type:write', 'reception:read', 'reception-bovine:read', 'bovine:read', 'building_case:read'])] private ?string $label = null; #[ORM\Column(length: 50)] #[Groups(['bovine-type:read', 'bovine-type:write', 'reception:read', 'reception-bovine:read', 'bovine:read', 'building_case:read'])] private ?string $code = null; /** * Détermine si le type bovin est proposé à la sélection lors d'une réception. * Les types créés automatiquement par la synchro inventaire arrivent à false ; * seul un admin peut les activer. */ #[ORM\Column(options: ['default' => false])] #[Groups(['bovine-type:read', 'bovine-type:write'])] private bool $display = false; public function getId(): ?int { return $this->id; } public function getLabel(): ?string { return $this->label; } public function setLabel(string $label): static { $this->label = $label; return $this; } public function getCode(): ?string { return $this->code; } public function setCode(string $code): static { $this->code = $code; return $this; } public function isDisplay(): bool { return $this->display; } public function setDisplay(bool $display): static { $this->display = $display; return $this; } }