File.php 810 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. declare (strict_types=1);
  3. namespace App\ApiResources\Core\File;
  4. use ApiPlatform\Metadata\ApiProperty;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use ApiPlatform\Metadata\Get;
  7. use App\State\Provider\Core\FileProvider;
  8. #[ApiResource(
  9. operations: [
  10. new Get(
  11. uriTemplate: 'file/download/{fileId}',
  12. requirements: ['fileId' => '\\d+'],
  13. security: 'is_granted("ROLE_FILE")',
  14. provider: FileProvider::class
  15. )
  16. ]
  17. )]
  18. class File
  19. {
  20. #[ApiProperty(identifier: true)]
  21. private int $fileId;
  22. /**
  23. * @return int
  24. */
  25. public function getFileId() : int
  26. {
  27. return $this->fileId;
  28. }
  29. /**
  30. * @param int $fileId
  31. */
  32. public function setFileId(int $fileId) : void
  33. {
  34. $this->fileId = $fileId;
  35. }
  36. }