src/Entity/DelayedJob.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DelayedJobRepository;
  4. use App\Traits\DateTrait;
  5. use DateTimeInterface;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @deprecated
  9. * * @ORM\Table(indexes={
  10. * @ORM\Index(columns={"alias"}),
  11. * @ORM\Index(columns={"status"}),
  12. * @ORM\Index(columns={"scheduled_at"}),
  13. * @ORM\Index(columns={"finished_at"})
  14. * })
  15. * @ORM\Entity(repositoryClass=DelayedJobRepository::class)
  16. */
  17. class DelayedJob
  18. {
  19. const STATUS_SCHEDULED = 'scheduled';
  20. const STATUS_RUNNING = 'running';
  21. const STATUS_FINISHED = 'finished';
  22. const STATUS_ERROR = 'error';
  23. const STATUS_CANCELED = 'canceled';
  24. /**
  25. * @ORM\Id
  26. * @ORM\GeneratedValue
  27. * @ORM\Column(type="integer")
  28. */
  29. private $id;
  30. /**
  31. * @ORM\Column(type="string", length=255)
  32. */
  33. private $alias;
  34. /**
  35. * @ORM\Column(type="text")
  36. */
  37. private $data;
  38. /**
  39. * @ORM\Column(type="string", length=32, options={"default":self::STATUS_SCHEDULED})
  40. */
  41. private $status = self::STATUS_SCHEDULED;
  42. /**
  43. * @ORM\Column(type="text", nullable=true)
  44. */
  45. private $log;
  46. /**
  47. * @ORM\Column(type="datetime", nullable=true)
  48. */
  49. private $scheduledAt;
  50. /**
  51. * @ORM\Column(type="datetime", nullable=true)
  52. */
  53. private $executedAt;
  54. /**
  55. * @ORM\Column(type="datetime", nullable=true)
  56. */
  57. private $finishedAt;
  58. /**
  59. * @ORM\ManyToOne(targetEntity=DelayedJob::class)
  60. */
  61. private $initialJob;
  62. /**
  63. * @ORM\ManyToOne(targetEntity=DelayedJob::class)
  64. */
  65. private $nextAttemptJob;
  66. /**
  67. * @ORM\ManyToOne(targetEntity=DelayedJob::class)
  68. */
  69. private $initialJob2;
  70. use DateTrait;
  71. /*
  72. * ============================================================================================
  73. * =============================== FONCTIONS CUSTOM ===========================================
  74. * ============================================================================================
  75. */
  76. /**
  77. * Return available statuses.
  78. *
  79. * @return string[]
  80. */
  81. public static function getStatuses(): array
  82. {
  83. return [
  84. self::STATUS_SCHEDULED,
  85. self::STATUS_RUNNING,
  86. self::STATUS_FINISHED,
  87. self::STATUS_ERROR,
  88. self::STATUS_CANCELED,
  89. ];
  90. }
  91. /*
  92. * ============================================================================================
  93. * ============================== FIN FONCTIONS CUSTOM ========================================
  94. * ============================================================================================
  95. */
  96. public function getId(): ?int
  97. {
  98. return $this->id;
  99. }
  100. public function getAlias(): ?string
  101. {
  102. return $this->alias;
  103. }
  104. public function setAlias( string $alias ): self
  105. {
  106. $this->alias = $alias;
  107. return $this;
  108. }
  109. public function getData(): ?string
  110. {
  111. return $this->data;
  112. }
  113. public function setData( string $data ): self
  114. {
  115. $this->data = $data;
  116. return $this;
  117. }
  118. public function getStatus(): ?string
  119. {
  120. return $this->status;
  121. }
  122. public function setStatus( string $status ): self
  123. {
  124. $this->status = $status;
  125. return $this;
  126. }
  127. public function getLog(): ?string
  128. {
  129. return $this->log;
  130. }
  131. public function setLog( ?string $log ): self
  132. {
  133. $this->log = $log;
  134. return $this;
  135. }
  136. public function getScheduledAt(): ?DateTimeInterface
  137. {
  138. return $this->scheduledAt;
  139. }
  140. public function setScheduledAt( ?DateTimeInterface $scheduledAt ): self
  141. {
  142. $this->scheduledAt = $scheduledAt;
  143. return $this;
  144. }
  145. public function getExecutedAt(): ?DateTimeInterface
  146. {
  147. return $this->executedAt;
  148. }
  149. public function setExecutedAt( ?DateTimeInterface $executedAt ): self
  150. {
  151. $this->executedAt = $executedAt;
  152. return $this;
  153. }
  154. public function getFinishedAt(): ?DateTimeInterface
  155. {
  156. return $this->finishedAt;
  157. }
  158. public function setFinishedAt( ?DateTimeInterface $finishedAt ): self
  159. {
  160. $this->finishedAt = $finishedAt;
  161. return $this;
  162. }
  163. public function getInitialJob(): ?self
  164. {
  165. return $this->initialJob;
  166. }
  167. public function setInitialJob( ?self $initialJob ): self
  168. {
  169. $this->initialJob = $initialJob;
  170. return $this;
  171. }
  172. public function getNextAttemptJob(): ?self
  173. {
  174. return $this->nextAttemptJob;
  175. }
  176. public function setNextAttemptJob( ?self $nextAttemptJob ): self
  177. {
  178. $this->nextAttemptJob = $nextAttemptJob;
  179. return $this;
  180. }
  181. public function getInitialJob2(): ?self
  182. {
  183. return $this->initialJob2;
  184. }
  185. public function setInitialJob2( ?self $initialJob2 ): self
  186. {
  187. $this->initialJob2 = $initialJob2;
  188. return $this;
  189. }
  190. }