405. * Permission alignee sur Bank (referentiel d'adresse partage clients/fournisseurs). * Pas de Timestampable/Blamable (referentiel statique whiteliste dans * EntitiesAreTimestampableBlamableTest::EXCLUDED, comme Bank). */ #[ApiResource( operations: [ new GetCollection( security: "is_granted('commercial.clients.view') or is_granted('commercial.suppliers.view')", normalizationContext: ['groups' => ['country:read']], // Tri par defaut : position ASC (France en tete) puis name ASC. order: ['position' => 'ASC', 'name' => 'ASC'], // Toggle ?pagination=false pour alimenter le select (cf. Bank). paginationClientEnabled: true, ), new Get( security: "is_granted('commercial.clients.view') or is_granted('commercial.suppliers.view')", normalizationContext: ['groups' => ['country:read']], ), ], security: "is_granted('commercial.clients.view') or is_granted('commercial.suppliers.view')", )] #[ORM\Entity(repositoryClass: DoctrineCountryRepository::class)] #[ORM\Table(name: 'country')] #[ORM\UniqueConstraint(name: 'uq_country_code', columns: ['code'])] class Country { #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] #[Groups(['country:read'])] private ?int $id = null; #[ORM\Column(length: 2)] #[Groups(['country:read'])] private ?string $code = null; #[ORM\Column(length: 80)] #[Groups(['country:read'])] private ?string $name = null; #[ORM\Column(options: ['default' => 0])] #[Groups(['country:read'])] private int $position = 0; public function getId(): ?int { return $this->id; } public function getCode(): ?string { return $this->code; } public function setCode(string $code): static { $this->code = $code; return $this; } public function getName(): ?string { return $this->name; } public function setName(string $name): static { $this->name = $name; return $this; } public function getPosition(): int { return $this->position; } public function setPosition(int $position): static { $this->position = $position; return $this; } }