Нет описания

ScheduledTaskEntity.php 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <?php
  2. namespace MailPoet\Entities;
  3. if (!defined('ABSPATH')) exit;
  4. use DateTimeInterface;
  5. use MailPoet\Doctrine\EntityTraits\AutoincrementedIdTrait;
  6. use MailPoet\Doctrine\EntityTraits\CreatedAtTrait;
  7. use MailPoet\Doctrine\EntityTraits\DeletedAtTrait;
  8. use MailPoet\Doctrine\EntityTraits\UpdatedAtTrait;
  9. use MailPoetVendor\Doctrine\ORM\Mapping as ORM;
  10. /**
  11. * @ORM\Entity()
  12. * @ORM\Table(name="scheduled_tasks")
  13. */
  14. class ScheduledTaskEntity {
  15. const STATUS_COMPLETED = 'completed';
  16. const STATUS_SCHEDULED = 'scheduled';
  17. const STATUS_PAUSED = 'paused';
  18. const STATUS_INVALID = 'invalid';
  19. const VIRTUAL_STATUS_RUNNING = 'running'; // For historical reasons this is stored as null in DB
  20. const PRIORITY_HIGH = 1;
  21. const PRIORITY_MEDIUM = 5;
  22. const PRIORITY_LOW = 10;
  23. use AutoincrementedIdTrait;
  24. use CreatedAtTrait;
  25. use UpdatedAtTrait;
  26. use DeletedAtTrait;
  27. /**
  28. * @ORM\Column(type="string", nullable=true)
  29. * @var string|null
  30. */
  31. private $type;
  32. /**
  33. * @ORM\Column(type="string", nullable=true)
  34. * @var string|null
  35. */
  36. private $status;
  37. /**
  38. * @ORM\Column(type="integer")
  39. * @var int
  40. */
  41. private $priority = 0;
  42. /**
  43. * @ORM\Column(type="datetimetz", nullable=true)
  44. * @var DateTimeInterface|null
  45. */
  46. private $scheduledAt;
  47. /**
  48. * @ORM\Column(type="datetimetz", nullable=true)
  49. * @var DateTimeInterface|null
  50. */
  51. private $processedAt;
  52. /**
  53. * @ORM\Column(type="json", nullable=true)
  54. * @var array|null
  55. */
  56. private $meta;
  57. /**
  58. * @ORM\OneToMany(targetEntity="MailPoet\Entities\ScheduledTaskSubscriberEntity", mappedBy="task", fetch="EXTRA_LAZY")
  59. */
  60. public $subscribers;
  61. /**
  62. * @return string|null
  63. */
  64. public function getType() {
  65. return $this->type;
  66. }
  67. /**
  68. * @param string|null $type
  69. */
  70. public function setType($type) {
  71. $this->type = $type;
  72. }
  73. /**
  74. * @return string|null
  75. */
  76. public function getStatus() {
  77. return $this->status;
  78. }
  79. /**
  80. * @param string|null $status
  81. */
  82. public function setStatus($status) {
  83. $this->status = $status;
  84. }
  85. /**
  86. * @return int
  87. */
  88. public function getPriority() {
  89. return $this->priority;
  90. }
  91. /**
  92. * @param int $priority
  93. */
  94. public function setPriority($priority) {
  95. $this->priority = $priority;
  96. }
  97. /**
  98. * @return DateTimeInterface|null
  99. */
  100. public function getScheduledAt() {
  101. return $this->scheduledAt;
  102. }
  103. /**
  104. * @param DateTimeInterface|null $scheduledAt
  105. */
  106. public function setScheduledAt($scheduledAt) {
  107. $this->scheduledAt = $scheduledAt;
  108. }
  109. /**
  110. * @return DateTimeInterface|null
  111. */
  112. public function getProcessedAt() {
  113. return $this->processedAt;
  114. }
  115. /**
  116. * @param DateTimeInterface|null $processedAt
  117. */
  118. public function setProcessedAt($processedAt) {
  119. $this->processedAt = $processedAt;
  120. }
  121. /**
  122. * @return array|null
  123. */
  124. public function getMeta() {
  125. return $this->meta;
  126. }
  127. /**
  128. * @param array|null $meta
  129. */
  130. public function setMeta($meta) {
  131. $this->meta = $meta;
  132. }
  133. }