1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Alpixel\Bundle\CronBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @ORM\Table(name="cronjob") |
9
|
|
|
* @ORM\Entity(repositoryClass="Alpixel\Bundle\CronBundle\Entity\Repository\CronJobRepository") |
10
|
|
|
*/ |
11
|
|
|
class CronJob |
12
|
|
|
{ |
13
|
|
|
/** |
14
|
|
|
* @ORM\Id |
15
|
|
|
* @ORM\Column(name="cron_id", type="integer") |
16
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
17
|
|
|
* |
18
|
|
|
* @var int |
19
|
|
|
*/ |
20
|
|
|
protected $id; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @ORM\Column |
24
|
|
|
* |
25
|
|
|
* @var string |
26
|
|
|
*/ |
27
|
|
|
protected $command; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @ORM\Column |
31
|
|
|
* |
32
|
|
|
* @var string |
33
|
|
|
*/ |
34
|
|
|
protected $description; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @ORM\Column(name="job_interval", type="string", length=40) |
38
|
|
|
* |
39
|
|
|
* @var string |
40
|
|
|
*/ |
41
|
|
|
protected $interval; |
42
|
|
|
/** |
43
|
|
|
* @ORM\Column(type="datetime") |
44
|
|
|
* |
45
|
|
|
* @var DateTime |
46
|
|
|
*/ |
47
|
|
|
protected $nextRun; |
48
|
|
|
/** |
49
|
|
|
* @ORM\Column(type="boolean") |
50
|
|
|
* |
51
|
|
|
* @var bool |
52
|
|
|
*/ |
53
|
|
|
protected $enabled; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @ORM\OneToMany(targetEntity="CronJobResult", mappedBy="job") |
57
|
|
|
* |
58
|
|
|
* @var ArrayCollection |
59
|
|
|
*/ |
60
|
|
|
protected $results; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @ORM\OneToOne(targetEntity="CronJobResult", cascade={"persist"}) |
64
|
|
|
* @ORM\JoinColumn(name="cron_result_id",referencedColumnName="cron_result_id", nullable=true, onDelete="SET NULL") |
65
|
|
|
* |
66
|
|
|
* @var CronJobResult |
67
|
|
|
*/ |
68
|
|
|
protected $mostRecentRun; |
69
|
|
|
|
70
|
|
|
public function __construct() |
71
|
|
|
{ |
72
|
|
|
$this->results = new \Doctrine\Common\Collections\ArrayCollection(); |
|
|
|
|
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* Get id. |
77
|
|
|
* |
78
|
|
|
* @return int |
79
|
|
|
*/ |
80
|
|
|
public function getId() |
81
|
|
|
{ |
82
|
|
|
return $this->id; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* Set command. |
87
|
|
|
* |
88
|
|
|
* @param string $command |
89
|
|
|
*/ |
90
|
|
|
public function setCommand($command) |
91
|
|
|
{ |
92
|
|
|
$this->command = $command; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Get command. |
97
|
|
|
* |
98
|
|
|
* @return string |
99
|
|
|
*/ |
100
|
|
|
public function getCommand() |
101
|
|
|
{ |
102
|
|
|
return $this->command; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Set description. |
107
|
|
|
* |
108
|
|
|
* @param string $description |
109
|
|
|
*/ |
110
|
|
|
public function setDescription($description) |
111
|
|
|
{ |
112
|
|
|
$this->description = $description; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Get description. |
117
|
|
|
* |
118
|
|
|
* @return string |
119
|
|
|
*/ |
120
|
|
|
public function getDescription() |
121
|
|
|
{ |
122
|
|
|
return $this->description; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* Set interval. |
127
|
|
|
* |
128
|
|
|
* @param string $interval |
129
|
|
|
*/ |
130
|
|
|
public function setInterval($interval) |
131
|
|
|
{ |
132
|
|
|
$this->interval = $interval; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Get interval. |
137
|
|
|
* |
138
|
|
|
* @return string |
139
|
|
|
*/ |
140
|
|
|
public function getInterval() |
141
|
|
|
{ |
142
|
|
|
return $this->interval; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Set nextRun. |
147
|
|
|
* |
148
|
|
|
* @param datetime $nextRun |
149
|
|
|
*/ |
150
|
|
|
public function setNextRun($nextRun) |
151
|
|
|
{ |
152
|
|
|
$this->nextRun = $nextRun; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* Get nextRun. |
157
|
|
|
* |
158
|
|
|
* @return datetime |
159
|
|
|
*/ |
160
|
|
|
public function getNextRun() |
161
|
|
|
{ |
162
|
|
|
return $this->nextRun; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
/** |
166
|
|
|
* Add results. |
167
|
|
|
* |
168
|
|
|
* @param Alpixel\Bundle\CronBundle\Entity\CronJobResult $results |
169
|
|
|
*/ |
170
|
|
|
public function addCronJobResult(\Alpixel\Bundle\CronBundle\Entity\CronJobResult $results) |
171
|
|
|
{ |
172
|
|
|
$this->results[] = $results; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* Get results. |
177
|
|
|
* |
178
|
|
|
* @return Doctrine\Common\Collections\Collection |
179
|
|
|
*/ |
180
|
|
|
public function getResults() |
181
|
|
|
{ |
182
|
|
|
return $this->results; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* Set mostRecentRun. |
187
|
|
|
* |
188
|
|
|
* @param Alpixel\Bundle\CronBundle\Entity\CronJobResult $mostRecentRun |
189
|
|
|
*/ |
190
|
|
|
public function setMostRecentRun(\Alpixel\Bundle\CronBundle\Entity\CronJobResult $mostRecentRun) |
191
|
|
|
{ |
192
|
|
|
$this->mostRecentRun = $mostRecentRun; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* Get mostRecentRun. |
197
|
|
|
* |
198
|
|
|
* @return Alpixel\Bundle\CronBundle\Entity\CronJobResult |
199
|
|
|
*/ |
200
|
|
|
public function getMostRecentRun() |
201
|
|
|
{ |
202
|
|
|
return $this->mostRecentRun; |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
/** |
206
|
|
|
* Set enabled. |
207
|
|
|
* |
208
|
|
|
* @param bool $enabled |
209
|
|
|
*/ |
210
|
|
|
public function setEnabled($enabled) |
211
|
|
|
{ |
212
|
|
|
$this->enabled = $enabled; |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
/** |
216
|
|
|
* Get enabled. |
217
|
|
|
* |
218
|
|
|
* @return bool |
219
|
|
|
*/ |
220
|
|
|
public function getEnabled() |
221
|
|
|
{ |
222
|
|
|
return $this->enabled; |
223
|
|
|
} |
224
|
|
|
} |
225
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..