| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <?php
- declare(strict_types=1);
- namespace App\ApiResources\Export;
- use ApiPlatform\Core\Annotation\ApiProperty;
- use ApiPlatform\Core\Annotation\ApiResource;
- use App\Entity\Access\Access;
- use Symfony\Component\Validator\Constraints as Assert;
- /**
- * Demande d'export d'un fichier
- * -- C'est la classe de base des ressources de type ExportRequest --
- */
- abstract class ExportRequest
- {
- /**
- * Id 'bidon' ajouté par défaut pour permettre la construction
- * de l'IRI par api platform
- *
- * @var int
- */
- #[ApiProperty(identifier: true)]
- protected int $id = 0;
- /**
- * Format de sortie attendu (pdf, txt...)
- * @var string
- */
- #[Assert\Choice(callback: ['\App\Enum\Export\ExportFormatEnum', 'toArray'], message: 'invalid-output-format')]
- protected string $format;
- /**
- * The id of the access requesting this export
- * @var int|null
- */
- protected ?int $requesterId = null;
- /**
- * Should the export be asynchrone
- * @var bool
- */
- protected bool $async = true;
- /**
- * The id of the db record of the file
- * @var int|null
- */
- protected ?int $fileId = null;
- /**
- * @return int
- */
- public function getId(): int
- {
- return $this->id;
- }
- /**
- * @return string
- */
- public function getFormat(): string
- {
- return $this->format;
- }
- /**
- * @param string $format
- */
- public function setFormat(string $format): void
- {
- $this->format = $format;
- }
- /**
- * @return int|null
- */
- public function getRequesterId(): ?int
- {
- return $this->requesterId;
- }
- /**
- * @param int|null $requesterId
- */
- public function setRequesterId(?int $requesterId): void
- {
- $this->requesterId = $requesterId;
- }
- /**
- * @return bool
- */
- public function isAsync(): bool
- {
- return $this->async;
- }
- /**
- * @param bool $async
- */
- public function setAsync(bool $async): void
- {
- $this->async = $async;
- }
- /**
- * @return int|null
- */
- public function getFileId(): ?int
- {
- return $this->fileId;
- }
- /**
- * @param int|null $fileId
- */
- public function setFileId(?int $fileId): void
- {
- $this->fileId = $fileId;
- }
- }
|