| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- declare(strict_types=1);
- namespace App\ApiResources;
- use ApiPlatform\Core\Annotation\ApiProperty;
- use ApiPlatform\Core\Annotation\ApiResource;
- /**
- * A request for a file from the LocalStorage
- */
- #[ApiResource(
- collectionOperations:[],
- itemOperations: [
- 'get' => [
- 'security' => 'is_granted("ROLE_FILE")',
- 'method' => 'GET',
- 'path' => '/download/{fileId}',
- 'requirements' => ['fileId' => '\d+']
- ],
- ],
- compositeIdentifier: false,
- )]
- class DownloadRequest
- {
- #[ApiProperty(identifier: true)]
- private int $fileId;
- /**
- * @return int
- */
- public function getFileId(): int
- {
- return $this->fileId;
- }
- /**
- * @param int $fileId
- */
- public function setFileId(int $fileId): void
- {
- $this->fileId = $fileId;
- }
- }
|