1 | <?php |
||
7 | class PdoMailJob extends MailJob |
||
8 | { |
||
9 | use EventHandlerTrait; |
||
10 | |||
11 | /** |
||
12 | * State new. |
||
13 | */ |
||
14 | const STATE_NEW = 'N'; |
||
15 | /** |
||
16 | * State active or in process. |
||
17 | */ |
||
18 | const STATE_ACTIVE = 'A'; |
||
19 | /** |
||
20 | * State completed. |
||
21 | */ |
||
22 | const STATE_COMPLETED = 'C'; |
||
23 | /** |
||
24 | * @var string the date value to when to send the email when processing the queue from a daemon. The format is |
||
25 | * `Y-m-d H:i:s` |
||
26 | */ |
||
27 | private $timeToSend; |
||
28 | /** |
||
29 | * @var string |
||
30 | */ |
||
31 | private $state = self::STATE_NEW; |
||
32 | |||
33 | /** |
||
34 | * {@inheritdoc} |
||
35 | */ |
||
36 | 6 | public function __construct(array $config = []) |
|
40 | |||
41 | /** |
||
42 | * @return string |
||
43 | */ |
||
44 | 4 | public function getTimeToSend() |
|
48 | |||
49 | /** |
||
50 | * @param string $date |
||
51 | */ |
||
52 | 5 | public function setTimeToSend($date) |
|
56 | |||
57 | /** |
||
58 | * @return string |
||
59 | */ |
||
60 | 3 | public function getState() |
|
64 | |||
65 | /** |
||
66 | * Marks the state as completed. After marking the instance as completed, we should call the |
||
67 | * `PdoQueueStoreAdapter::ack()` method to update the database with new status. |
||
68 | */ |
||
69 | 2 | public function markAsCompleted() |
|
75 | |||
76 | /** |
||
77 | * Marks the state as new. If we update the status back to 'N'ew, we could send it back to queue by using the |
||
78 | * `PdoQueueStoreAdapter::ack()` method. That means even including a new time to be processed in the future by |
||
79 | * setting the `$timeToSend` in a future date. |
||
80 | */ |
||
81 | 1 | public function markAsNew() |
|
85 | } |
||
86 |