src/Entity/Channel/Export/FileExport.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Channel\Export;
  3. use App\Entity\Channel\Channel;
  4. use App\Entity\Common\File;
  5. use App\Enum\Channel\FileExportStatusEnum;
  6. use App\Repository\Channel\Export\FileExportRepository;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Doctrine\ORM\Mapping\JoinColumn;
  9. use Doctrine\ORM\Mapping\ManyToOne;
  10. #[
  11. ORM\Entity(repositoryClass: FileExportRepository::class),
  12. ORM\Table(name: 'file_channel_export'),
  13. ]
  14. class FileExport extends File
  15. {
  16. #[ManyToOne(targetEntity: Channel::class, fetch: 'EAGER')]
  17. #[JoinColumn(nullable: true, onDelete: 'CASCADE')]
  18. private ?Channel $channel = null;
  19. #[ORM\Column(type: 'string', length: 255)]
  20. private string $status = FileExportStatusEnum::STATUS_PENDING;
  21. #[ORM\Column(type: 'simple_array', nullable: false)]
  22. private array $payload = [];
  23. #[ORM\Column(type: 'json', nullable: true)]
  24. private ?array $options = null;
  25. #[ORM\Column(type: 'integer', nullable: false)]
  26. private int $prepared = 0;
  27. #[ORM\Column(type: 'string', length: 255, nullable: false)]
  28. private ?string $tag = null;
  29. public static function getFileSystemAlias(): string
  30. {
  31. return 'export_filesystem';
  32. }
  33. public static function getUploaderAlias(): ?string
  34. {
  35. return null;
  36. }
  37. public function incrementPrepared(): void
  38. {
  39. $this->prepared++;
  40. }
  41. public function isReady(): bool
  42. {
  43. return $this->prepared >= count($this->payload);
  44. }
  45. public function getChannel(): ?Channel
  46. {
  47. return $this->channel;
  48. }
  49. public function setChannel(?Channel $channel): FileExport
  50. {
  51. $this->channel = $channel;
  52. return $this;
  53. }
  54. public function getStatus(): string
  55. {
  56. return $this->status;
  57. }
  58. public function setStatus(string $status): FileExport
  59. {
  60. $this->status = $status;
  61. return $this;
  62. }
  63. public function getPayload(): array
  64. {
  65. return $this->payload;
  66. }
  67. public function setPayload(array $payload): FileExport
  68. {
  69. $this->payload = $payload;
  70. return $this;
  71. }
  72. public function getPrepared(): int
  73. {
  74. return $this->prepared;
  75. }
  76. public function setPrepared(int $prepared): FileExport
  77. {
  78. $this->prepared = $prepared;
  79. return $this;
  80. }
  81. public function getTag(): ?string
  82. {
  83. return $this->tag;
  84. }
  85. public function setTag(?string $tag): FileExport
  86. {
  87. $this->tag = $tag;
  88. return $this;
  89. }
  90. public function getOptions(): ?array
  91. {
  92. return $this->options;
  93. }
  94. public function setOptions(?array $options): FileExport
  95. {
  96. $this->options = $options;
  97. return $this;
  98. }
  99. }