1 | <?php |
||
13 | class TaskEvent implements TaskEventInterface |
||
14 | { |
||
15 | /** |
||
16 | * @var integer |
||
17 | * |
||
18 | * @ORM\Column(name="id", type="integer") |
||
19 | * @ORM\Id |
||
20 | * @ORM\GeneratedValue(strategy="AUTO") |
||
21 | */ |
||
22 | private $id; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | * |
||
27 | * @ORM\Column(name="task_name", type="string", length=100) |
||
28 | */ |
||
29 | private $taskName; |
||
30 | |||
31 | |||
32 | /** |
||
33 | * Many of the Tasks that are run have a specified time that they run for. Because of this, we store the TargetTime |
||
34 | * outside of the payload. This helps significantly with querying what commands have been run for a date, as well. |
||
35 | * |
||
36 | * @var \DateTime |
||
37 | * |
||
38 | * @ORM\Column(name="target_time", type="datetime", nullable=true) |
||
39 | */ |
||
40 | private $targetTime; |
||
41 | |||
42 | /** |
||
43 | * @var array |
||
44 | * |
||
45 | * @ORM\Column(name="payload", type="array") |
||
46 | */ |
||
47 | private $payload; |
||
48 | |||
49 | /** |
||
50 | * @var \DateTime |
||
51 | * |
||
52 | * @ORM\Column(name="initiated_at", type="datetime", nullable=true) |
||
53 | */ |
||
54 | private $initiatedAt; |
||
55 | |||
56 | /** |
||
57 | * @var \DateTime |
||
58 | * |
||
59 | * @ORM\Column(name="failed_at", type="datetime", nullable=true) |
||
60 | */ |
||
61 | private $failedAt; |
||
62 | |||
63 | /** |
||
64 | * @var \DateTime |
||
65 | * |
||
66 | * @ORM\Column(name="completed_at", type="datetime", nullable=true) |
||
67 | */ |
||
68 | private $completedAt; |
||
69 | |||
70 | /** |
||
71 | * @var array|null |
||
72 | * |
||
73 | * @ORM\Column(name="errors", type="json_array", nullable=true) |
||
74 | */ |
||
75 | private $errors; |
||
76 | |||
77 | /** |
||
78 | * @return int |
||
79 | */ |
||
80 | public function getId() |
||
84 | |||
85 | /** |
||
86 | * @return string |
||
87 | */ |
||
88 | 1 | public function getTaskName() |
|
92 | |||
93 | /** |
||
94 | * @param string $taskName |
||
95 | * @return TaskEvent |
||
96 | */ |
||
97 | 1 | public function setTaskName($taskName) |
|
102 | |||
103 | /** |
||
104 | * @return array |
||
105 | */ |
||
106 | public function getPayload() |
||
110 | |||
111 | /** |
||
112 | * @param array $payload |
||
113 | * @return TaskEvent |
||
114 | */ |
||
115 | 1 | public function setPayload($payload) |
|
120 | |||
121 | /** |
||
122 | * @return \DateTime |
||
123 | */ |
||
124 | 1 | public function getInitiatedAt() |
|
128 | |||
129 | /** |
||
130 | * @param \DateTime $initiatedAt |
||
131 | * @return TaskEvent |
||
132 | */ |
||
133 | 1 | public function setInitiatedAt(\DateTime $initiatedAt) |
|
138 | |||
139 | /** |
||
140 | * @return \DateTime |
||
141 | */ |
||
142 | 2 | public function getCompletedAt() |
|
146 | |||
147 | /** |
||
148 | * @param \DateTime $completedAt |
||
149 | * @return TaskEvent |
||
150 | */ |
||
151 | 2 | public function setCompletedAt(\DateTime $completedAt) |
|
156 | |||
157 | /** |
||
158 | * @return \DateTime |
||
159 | */ |
||
160 | 2 | public function getFailedAt() |
|
164 | |||
165 | /** |
||
166 | * @param $failedAt |
||
167 | * @return $this |
||
168 | */ |
||
169 | 2 | public function setFailedAt(\DateTime $failedAt) |
|
174 | |||
175 | /** |
||
176 | * @return array |
||
177 | */ |
||
178 | 4 | public function getErrors() |
|
182 | |||
183 | /** |
||
184 | * @param array|null $errors |
||
185 | * @return $this |
||
186 | */ |
||
187 | 2 | public function setErrors(array $errors = null) |
|
193 | |||
194 | /** |
||
195 | * @return \DateTime |
||
196 | */ |
||
197 | 1 | public function getTargetTime() |
|
201 | |||
202 | /** |
||
203 | * @param \DateTime $targetTime |
||
204 | * @return $this |
||
205 | */ |
||
206 | 1 | public function setTargetTime($targetTime = null) |
|
212 | |||
213 | /** |
||
214 | * @return TaskEventInterface |
||
215 | */ |
||
216 | 1 | public function initiate() |
|
220 | |||
221 | /** |
||
222 | * @return TaskEventInterface |
||
223 | */ |
||
224 | 2 | public function setAsCompleted() |
|
228 | |||
229 | /** |
||
230 | * @param array $errors |
||
231 | */ |
||
232 | 2 | public function setAsFailed(array $errors) |
|
238 | |||
239 | /** |
||
240 | * @param $name |
||
241 | * @param TaskTypeInterface $taskType |
||
242 | * @return TaskEventInterface |
||
243 | */ |
||
244 | 1 | public function intialize($name, TaskTypeInterface $taskType) |
|
251 | |||
252 | /** @return bool */ |
||
253 | public function isComplete() |
||
257 | |||
258 | /** @return bool */ |
||
259 | public function isFailed() |
||
263 | } |
||
264 |