DownloadRequest.php 862 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\ApiResources;
  4. use ApiPlatform\Core\Annotation\ApiProperty;
  5. use ApiPlatform\Core\Annotation\ApiResource;
  6. /**
  7. * A request for a file from the LocalStorage
  8. */
  9. #[ApiResource(
  10. collectionOperations:[],
  11. itemOperations: [
  12. 'get' => [
  13. 'security' => 'is_granted("ROLE_FILE")',
  14. 'method' => 'GET',
  15. 'path' => '/download/{fileId}',
  16. 'requirements' => ['fileId' => '\d+']
  17. ],
  18. ],
  19. compositeIdentifier: false,
  20. )]
  21. class DownloadRequest
  22. {
  23. #[ApiProperty(identifier: true)]
  24. private int $fileId;
  25. /**
  26. * @return int
  27. */
  28. public function getFileId(): int
  29. {
  30. return $this->fileId;
  31. }
  32. /**
  33. * @param int $fileId
  34. */
  35. public function setFileId(int $fileId): void
  36. {
  37. $this->fileId = $fileId;
  38. }
  39. }