src/Domain/Entity/Region.php line 30

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Domain\Entity;
  4. use ApiPlatform\Metadata\ApiProperty;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use ApiPlatform\Metadata\Delete;
  7. use ApiPlatform\Metadata\Get;
  8. use ApiPlatform\Metadata\GetCollection;
  9. use ApiPlatform\Metadata\Post;
  10. use ApiPlatform\Metadata\Put;
  11. use Gedmo\SoftDeleteable\Traits\SoftDeleteable;
  12. #[ApiResource(
  13.     operations            : [
  14.         new Delete(security"is_granted('ROLE_ADMIN')"),
  15.         new GetCollection(
  16.             paginationEnabledfalse,
  17.         ),
  18.         new Get(),
  19.         new Post(security"is_granted('ROLE_ADMIN')"),
  20.         new Put(security"is_granted('ROLE_ADMIN')"),
  21.     ],
  22.     normalizationContext  : ['groups' => ['region_read']],
  23.     denormalizationContext: ['groups' => ['region_write']],
  24.     order                 : ["countryCode" => "DESC"]
  25. )]
  26. class Region
  27. {
  28.     use SoftDeleteable;
  29.     #[ApiProperty(identifiertrue)]
  30.     public ?int $id null;
  31.     public function __construct(
  32.         public string $name,
  33.         public string $iso31665,
  34.         public string $countryName,
  35.         public int $countryCode,
  36.         public ?string $remoteId null
  37.     ) {
  38.     }
  39. }