1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Oliverde8\PhpEtlBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Oliverde8\PhpEtlBundle\Repository\EtlExecutionRepository; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* @ORM\Entity(repositoryClass=EtlExecutionRepository::class) |
10
|
|
|
*/ |
11
|
|
|
class EtlExecution |
12
|
|
|
{ |
13
|
|
|
public const STATUS_WAITING ="waiting"; |
14
|
|
|
public const STATUS_QUEUED ="queued"; |
15
|
|
|
public const STATUS_RUNNING = "running"; |
16
|
|
|
public const STATUS_SUCCESS = "success"; |
17
|
|
|
public const STATUS_FAILURE = "failure"; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @ORM\Id |
21
|
|
|
* @ORM\GeneratedValue |
22
|
|
|
* @ORM\Column(type="integer") |
23
|
|
|
*/ |
24
|
|
|
private $id; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @ORM\Column(type="string", length=255) |
28
|
|
|
*/ |
29
|
|
|
private $name; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @ORM\Column(type="string", length=255, nullable=true) |
33
|
|
|
*/ |
34
|
|
|
private $username; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @ORM\Column(type="text", nullable=true) |
38
|
|
|
*/ |
39
|
|
|
private $inputData; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @ORM\Column(type="text", nullable=true) |
43
|
|
|
*/ |
44
|
|
|
private $inputOptions; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @ORM\Column(type="datetime") |
48
|
|
|
*/ |
49
|
|
|
private $createTime; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @ORM\Column(type="datetime", nullable=true) |
53
|
|
|
*/ |
54
|
|
|
private $startTime; |
55
|
|
|
/** |
56
|
|
|
* @ORM\Column(type="integer") |
57
|
|
|
*/ |
58
|
|
|
private $waitTime = 0; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @ORM\Column(type="datetime", nullable=true) |
62
|
|
|
*/ |
63
|
|
|
private $endTime; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @ORM\Column(type="integer") |
67
|
|
|
*/ |
68
|
|
|
private $runTime = 0; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @ORM\Column(type="datetime", nullable=true) |
72
|
|
|
*/ |
73
|
|
|
private $failTime; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @ORM\Column(type="text") |
77
|
|
|
*/ |
78
|
|
|
private $definition; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @ORM\Column(type="text", nullable=true) |
82
|
|
|
*/ |
83
|
|
|
private $errorMessage; |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @ORM\Column(type="text", nullable=true) |
87
|
|
|
*/ |
88
|
|
|
private $stepStats; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @ORM\Column(type="string", length=255) |
92
|
|
|
*/ |
93
|
|
|
private $status; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* EtlExecution constructor. |
97
|
|
|
* @param string $name |
98
|
|
|
* @param string $definition |
99
|
|
|
*/ |
100
|
|
|
public function __construct(string $name, string $definition, array $inputData, array $inputOptions) |
101
|
|
|
{ |
102
|
|
|
$this->name = $name; |
103
|
|
|
$this->definition = $definition; |
104
|
|
|
$this->createTime = new \DateTime(); |
105
|
|
|
$this->status = self::STATUS_WAITING; |
106
|
|
|
|
107
|
|
|
$this->inputData = json_encode($inputData); |
108
|
|
|
$this->inputOptions = json_encode($inputOptions); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
|
112
|
|
|
public function getId(): ?int |
113
|
|
|
{ |
114
|
|
|
return $this->id; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
public function getName(): ?string |
118
|
|
|
{ |
119
|
|
|
return $this->name; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
public function setName(string $name): self |
123
|
|
|
{ |
124
|
|
|
$this->name = $name; |
125
|
|
|
|
126
|
|
|
return $this; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @return mixed |
131
|
|
|
*/ |
132
|
|
|
public function getUsername() |
133
|
|
|
{ |
134
|
|
|
return $this->username; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* @param mixed $username |
139
|
|
|
*/ |
140
|
|
|
public function setUsername($username): void |
141
|
|
|
{ |
142
|
|
|
$this->username = $username; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @return mixed |
147
|
|
|
*/ |
148
|
|
|
public function getInputData() |
149
|
|
|
{ |
150
|
|
|
return $this->inputData; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @param mixed $inputData |
155
|
|
|
*/ |
156
|
|
|
public function setInputData($inputData): void |
157
|
|
|
{ |
158
|
|
|
$this->inputData = $inputData; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @return mixed |
163
|
|
|
*/ |
164
|
|
|
public function getInputOptions() |
165
|
|
|
{ |
166
|
|
|
return $this->inputOptions; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* @param mixed $inputOptions |
171
|
|
|
*/ |
172
|
|
|
public function setInputOptions($inputOptions): void |
173
|
|
|
{ |
174
|
|
|
$this->inputOptions = $inputOptions; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
public function getCreateTime(): \DateTime |
178
|
|
|
{ |
179
|
|
|
return $this->createTime; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
public function setCreateTime(\DateTime $createTime): void |
183
|
|
|
{ |
184
|
|
|
$this->createTime = $createTime; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
public function getStartTime(): ?\DateTimeInterface |
188
|
|
|
{ |
189
|
|
|
return $this->startTime; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
public function setStartTime(\DateTimeInterface $startTime): self |
193
|
|
|
{ |
194
|
|
|
$this->startTime = $startTime; |
195
|
|
|
|
196
|
|
|
return $this; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* @return int |
201
|
|
|
*/ |
202
|
|
|
public function getWaitTime(): int |
203
|
|
|
{ |
204
|
|
|
return $this->waitTime; |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
/** |
208
|
|
|
* @param int $waitTime |
209
|
|
|
*/ |
210
|
|
|
public function setWaitTime(int $waitTime): void |
211
|
|
|
{ |
212
|
|
|
$this->waitTime = $waitTime; |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
/** |
216
|
|
|
* @return mixed |
217
|
|
|
*/ |
218
|
|
|
public function getFailTime() |
219
|
|
|
{ |
220
|
|
|
return $this->failTime; |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
/** |
224
|
|
|
* @param mixed $failTime |
225
|
|
|
*/ |
226
|
|
|
public function setFailTime($failTime): void |
227
|
|
|
{ |
228
|
|
|
$this->failTime = $failTime; |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
public function getEndTime(): ?\DateTimeInterface |
232
|
|
|
{ |
233
|
|
|
return $this->endTime; |
234
|
|
|
} |
235
|
|
|
|
236
|
|
|
public function setEndTime(?\DateTimeInterface $endTime): self |
237
|
|
|
{ |
238
|
|
|
$this->endTime = $endTime; |
239
|
|
|
|
240
|
|
|
return $this; |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
/** |
244
|
|
|
* @return int |
245
|
|
|
*/ |
246
|
|
|
public function getRunTime(): int |
247
|
|
|
{ |
248
|
|
|
return $this->runTime; |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
/** |
252
|
|
|
* @param int $runTime |
253
|
|
|
*/ |
254
|
|
|
public function setRunTime(int $runTime): void |
255
|
|
|
{ |
256
|
|
|
$this->runTime = $runTime; |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
/** |
260
|
|
|
* @return mixed |
261
|
|
|
*/ |
262
|
|
|
public function getErrorMessage() |
263
|
|
|
{ |
264
|
|
|
return $this->errorMessage; |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
/** |
268
|
|
|
* @param mixed $errorMessage |
269
|
|
|
*/ |
270
|
|
|
public function setErrorMessage($errorMessage): void |
271
|
|
|
{ |
272
|
|
|
$this->errorMessage = $errorMessage; |
273
|
|
|
} |
274
|
|
|
|
275
|
|
|
public function getDefinition(): ?string |
276
|
|
|
{ |
277
|
|
|
return $this->definition; |
278
|
|
|
} |
279
|
|
|
|
280
|
|
|
public function setDefinition(string $definition): self |
281
|
|
|
{ |
282
|
|
|
$this->definition = $definition; |
283
|
|
|
|
284
|
|
|
return $this; |
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
public function getStepStats(): ?string |
288
|
|
|
{ |
289
|
|
|
return $this->stepStats; |
290
|
|
|
} |
291
|
|
|
|
292
|
|
|
public function setStepStats(?string $stepStats): self |
293
|
|
|
{ |
294
|
|
|
$this->stepStats = $stepStats; |
295
|
|
|
|
296
|
|
|
return $this; |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* @return string |
301
|
|
|
*/ |
302
|
|
|
public function getStatus(): string |
303
|
|
|
{ |
304
|
|
|
return $this->status; |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* @param string $status |
309
|
|
|
*/ |
310
|
|
|
public function setStatus(string $status): void |
311
|
|
|
{ |
312
|
|
|
$this->status = $status; |
313
|
|
|
} |
314
|
|
|
} |
315
|
|
|
|