src/Domain/Entity/TripExport.php line 27

Open in your IDE?
  1. <?php
  2. namespace App\Domain\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use ApiPlatform\Metadata\Delete;
  5. use ApiPlatform\Metadata\Get;
  6. use ApiPlatform\Metadata\GetCollection;
  7. use App\Application\Controller\Api\TripExport\DeleteAction;
  8. use App\Application\Controller\Api\TripExport\DownloadAction;
  9. use App\Domain\Entity\Behavior\Identifiable;
  10. use Gedmo\Timestampable\Traits\Timestampable;
  11. #[ApiResource(
  12.     operations          : [
  13.         new GetCollection(security"is_granted('ROLE_ADMIN')"),
  14.         new Get(uriTemplate'trip_exports/{uuid}'security"is_granted('ROLE_ADMIN')"),
  15.         new Get(
  16.             uriTemplate'trip_exports/{uuid}/download',
  17.             controller DownloadAction::class,
  18.             security   "is_granted('ROLE_ADMIN')"
  19.         ),
  20.         new Delete(controllerDeleteAction::class, security"is_granted('ROLE_ADMIN')"),
  21.     ],
  22.     normalizationContext: ['groups' => ['trip_export_read']],
  23. )]
  24. class TripExport
  25. {
  26.     use Timestampable;
  27.     use Identifiable;
  28.     public const STATUS_PENDING "pending";
  29.     public const STATUS_SUCCESS "success";
  30.     public const STATUS_ERROR   "error";
  31.     public function __construct(
  32.         public ?string $path null,
  33.         public string $status self::STATUS_PENDING,
  34.         public ?string $error null,
  35.     ) {}
  36. }