1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the Commander project. |
4
|
|
|
* |
5
|
|
|
* @author Daniel Schröder <[email protected]> |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
namespace GravityMedia\Commander\ORM; |
9
|
|
|
|
10
|
|
|
use Doctrine\ORM\Mapping as ORM; |
11
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Task entity class. |
15
|
|
|
* |
16
|
|
|
* @package GravityMedia\Commander\ORM |
17
|
|
|
* |
18
|
|
|
* @ORM\Entity |
19
|
|
|
* @ORM\Table(name="task") |
20
|
|
|
* @ORM\Entity(repositoryClass="GravityMedia\Commander\ORM\TaskEntityRepository") |
21
|
|
|
**/ |
22
|
|
|
class TaskEntity |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* The default priority. |
26
|
|
|
*/ |
27
|
|
|
const DEFAULT_PRIORITY = 1; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* The ID. |
31
|
|
|
* |
32
|
|
|
* @var string |
33
|
|
|
* |
34
|
|
|
* @ORM\Id |
35
|
|
|
* @ORM\GeneratedValue(strategy="UUID") |
36
|
|
|
* @ORM\Column(type="guid") |
37
|
|
|
**/ |
38
|
|
|
private $id; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* The priority. |
42
|
|
|
* |
43
|
|
|
* @var int |
44
|
|
|
* |
45
|
|
|
* @ORM\Column(type="integer") |
46
|
|
|
*/ |
47
|
|
|
private $priority; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* The commandline. |
51
|
|
|
* |
52
|
|
|
* @var string |
53
|
|
|
* |
54
|
|
|
* @ORM\Column(type="string") |
55
|
|
|
**/ |
56
|
|
|
private $commandline; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* The PID. |
60
|
|
|
* |
61
|
|
|
* @var int |
62
|
|
|
* |
63
|
|
|
* @ORM\Column(type="integer", nullable=true) |
64
|
|
|
**/ |
65
|
|
|
private $pid; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* The exit code. |
69
|
|
|
* |
70
|
|
|
* @var int |
71
|
|
|
* |
72
|
|
|
* @ORM\Column(type="integer", nullable=true) |
73
|
|
|
*/ |
74
|
|
|
private $exitCode; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* The timestamp when the task was created. |
78
|
|
|
* |
79
|
|
|
* @var \DateTime $createdAt |
80
|
|
|
* |
81
|
|
|
* @Gedmo\Timestampable(on="create") |
82
|
|
|
* @ORM\Column(type="datetime") |
83
|
|
|
*/ |
84
|
|
|
private $createdAt; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* The timestamp when the task was updated. |
88
|
|
|
* |
89
|
|
|
* @var \DateTime $updatedAt |
90
|
|
|
* |
91
|
|
|
* @Gedmo\Timestampable(on="update") |
92
|
|
|
* @ORM\Column(type="datetime") |
93
|
|
|
*/ |
94
|
|
|
private $updatedAt; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Get ID. |
98
|
|
|
* |
99
|
|
|
* @return string |
100
|
|
|
*/ |
101
|
2 |
|
public function getId() |
102
|
|
|
{ |
103
|
2 |
|
return $this->id; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* Get priority. |
108
|
|
|
* |
109
|
|
|
* @return int |
110
|
|
|
*/ |
111
|
2 |
|
public function getPriority() |
112
|
|
|
{ |
113
|
2 |
|
return $this->priority; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Set priority. |
118
|
|
|
* |
119
|
|
|
* @param int $priority |
120
|
|
|
* |
121
|
|
|
* @return $this |
122
|
|
|
*/ |
123
|
2 |
|
public function setPriority($priority) |
124
|
|
|
{ |
125
|
2 |
|
$this->priority = $priority; |
126
|
2 |
|
return $this; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* Get commandline. |
131
|
|
|
* |
132
|
|
|
* @return string |
133
|
|
|
*/ |
134
|
2 |
|
public function getCommandline() |
135
|
|
|
{ |
136
|
2 |
|
return $this->commandline; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* Set commandline. |
141
|
|
|
* |
142
|
|
|
* @param string $commandline |
143
|
|
|
* |
144
|
|
|
* @return $this |
145
|
|
|
*/ |
146
|
2 |
|
public function setCommandline($commandline) |
147
|
|
|
{ |
148
|
2 |
|
$this->commandline = $commandline; |
149
|
2 |
|
return $this; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
/** |
153
|
|
|
* Get PID. |
154
|
|
|
* |
155
|
|
|
* @return int |
156
|
|
|
*/ |
157
|
2 |
|
public function getPid() |
158
|
|
|
{ |
159
|
2 |
|
return $this->pid; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* Set PID. |
164
|
|
|
* |
165
|
|
|
* @param int $pid |
166
|
|
|
* |
167
|
|
|
* @return $this |
168
|
|
|
*/ |
169
|
2 |
|
public function setPid($pid) |
170
|
|
|
{ |
171
|
2 |
|
$this->pid = $pid; |
172
|
2 |
|
return $this; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* Get exit code. |
177
|
|
|
* |
178
|
|
|
* @return int |
179
|
|
|
*/ |
180
|
2 |
|
public function getExitCode() |
181
|
|
|
{ |
182
|
2 |
|
return $this->exitCode; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* Set exit code. |
187
|
|
|
* |
188
|
|
|
* @param int $exitCode |
189
|
|
|
* |
190
|
|
|
* @return $this |
191
|
|
|
*/ |
192
|
2 |
|
public function setExitCode($exitCode) |
193
|
|
|
{ |
194
|
2 |
|
$this->exitCode = $exitCode; |
195
|
2 |
|
return $this; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* Get timestamp when the task was created. |
200
|
|
|
* |
201
|
|
|
* @return \DateTime |
202
|
|
|
*/ |
203
|
2 |
|
public function getCreatedAt() |
204
|
|
|
{ |
205
|
2 |
|
return $this->createdAt; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* Set timestamp when the task was created. |
210
|
|
|
* |
211
|
|
|
* @param \DateTime $createdAt |
212
|
|
|
* |
213
|
|
|
* @return $this |
214
|
|
|
*/ |
215
|
2 |
|
public function setCreatedAt(\DateTime $createdAt) |
216
|
|
|
{ |
217
|
2 |
|
$this->createdAt = $createdAt; |
218
|
2 |
|
return $this; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
/** |
222
|
|
|
* Get timestamp when the task was updated. |
223
|
|
|
* |
224
|
|
|
* @return \DateTime |
225
|
|
|
*/ |
226
|
2 |
|
public function getUpdatedAt() |
227
|
|
|
{ |
228
|
2 |
|
return $this->updatedAt; |
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* Set timestamp when the task was updated. |
233
|
|
|
* |
234
|
|
|
* @param \DateTime $updatedAt |
235
|
|
|
* |
236
|
|
|
* @return $this |
237
|
|
|
*/ |
238
|
2 |
|
public function setUpdatedAt(\DateTime $updatedAt) |
239
|
|
|
{ |
240
|
2 |
|
$this->updatedAt = $updatedAt; |
241
|
2 |
|
return $this; |
242
|
|
|
} |
243
|
|
|
} |
244
|
|
|
|