1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Alpixel\Bundle\CronBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* @ORM\Table(name="cronjob_result") |
9
|
|
|
* @ORM\Entity(repositoryClass="Alpixel\Bundle\CronBundle\Entity\Repository\CronJobResultRepository") |
10
|
|
|
*/ |
11
|
|
|
class CronJobResult |
12
|
|
|
{ |
13
|
|
|
const RESULT_MIN = 0; |
14
|
|
|
const SUCCEEDED = 0; |
15
|
|
|
const FAILED = 1; |
16
|
|
|
const SKIPPED = 2; |
17
|
|
|
const RESULT_MAX = 2; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* @ORM\Id |
21
|
|
|
* @ORM\Column(name="cron_result_id", type="integer") |
22
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
23
|
|
|
* |
24
|
|
|
* @var int |
25
|
|
|
*/ |
26
|
|
|
protected $id; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @ORM\Column(type="datetime") |
30
|
|
|
* |
31
|
|
|
* @var DateTime |
32
|
|
|
*/ |
33
|
|
|
protected $runAt; |
34
|
|
|
/** |
35
|
|
|
* @ORM\Column(type="float") |
36
|
|
|
* |
37
|
|
|
* @var float |
38
|
|
|
*/ |
39
|
|
|
protected $runTime; |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* @ORM\Column(type="integer", nullable=true) |
43
|
|
|
* |
44
|
|
|
* @var int |
45
|
|
|
*/ |
46
|
|
|
protected $result; |
47
|
|
|
/** |
48
|
|
|
* @ORM\Column(type="text") |
49
|
|
|
* |
50
|
|
|
* @var string |
51
|
|
|
*/ |
52
|
|
|
protected $output; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @ORM\ManyToOne(targetEntity="CronJob", inversedBy="results") |
56
|
|
|
* @ORM\JoinColumn(name="cron_id",referencedColumnName="cron_id", nullable=false, onDelete="CASCADE") |
57
|
|
|
* |
58
|
|
|
* @var CronJob |
59
|
|
|
*/ |
60
|
|
|
protected $job; |
61
|
|
|
|
62
|
|
|
public function __construct() |
63
|
|
|
{ |
64
|
|
|
$this->runAt = new \DateTime(); |
|
|
|
|
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Get id. |
69
|
|
|
* |
70
|
|
|
* @return int |
71
|
|
|
*/ |
72
|
|
|
public function getId() |
73
|
|
|
{ |
74
|
|
|
return $this->id; |
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Set runAt. |
79
|
|
|
* |
80
|
|
|
* @param datetime $runAt |
81
|
|
|
*/ |
82
|
|
|
public function setRunAt($runAt) |
83
|
|
|
{ |
84
|
|
|
$this->runAt = $runAt; |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Get runAt. |
89
|
|
|
* |
90
|
|
|
* @return datetime |
91
|
|
|
*/ |
92
|
|
|
public function getRunAt() |
93
|
|
|
{ |
94
|
|
|
return $this->runAt; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Set runTime. |
99
|
|
|
* |
100
|
|
|
* @param float $runTime |
101
|
|
|
*/ |
102
|
|
|
public function setRunTime($runTime) |
103
|
|
|
{ |
104
|
|
|
$this->runTime = $runTime; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Get runTime. |
109
|
|
|
* |
110
|
|
|
* @return float |
111
|
|
|
*/ |
112
|
|
|
public function getRunTime() |
113
|
|
|
{ |
114
|
|
|
return $this->runTime; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* Set result. |
119
|
|
|
* |
120
|
|
|
* @param int $result |
121
|
|
|
*/ |
122
|
|
|
public function setResult($result) |
123
|
|
|
{ |
124
|
|
|
$this->result = $result; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* Get result. |
129
|
|
|
* |
130
|
|
|
* @return int |
131
|
|
|
*/ |
132
|
|
|
public function getResult() |
133
|
|
|
{ |
134
|
|
|
return $this->result; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
/** |
138
|
|
|
* Set output. |
139
|
|
|
* |
140
|
|
|
* @param string $output |
141
|
|
|
*/ |
142
|
|
|
public function setOutput($output) |
143
|
|
|
{ |
144
|
|
|
$this->output = $output; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
/** |
148
|
|
|
* Get output. |
149
|
|
|
* |
150
|
|
|
* @return string |
151
|
|
|
*/ |
152
|
|
|
public function getOutput() |
153
|
|
|
{ |
154
|
|
|
return $this->output; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Set job. |
159
|
|
|
* |
160
|
|
|
* @param Alpixel\Bundle\CronBundle\Entity\CronJob $job |
161
|
|
|
*/ |
162
|
|
|
public function setJob(\Alpixel\Bundle\CronBundle\Entity\CronJob $job) |
163
|
|
|
{ |
164
|
|
|
$this->job = $job; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* Get job. |
169
|
|
|
* |
170
|
|
|
* @return Alpixel\Bundle\CronBundle\Entity\CronJob |
171
|
|
|
*/ |
172
|
|
|
public function getJob() |
173
|
|
|
{ |
174
|
|
|
return $this->job; |
175
|
|
|
} |
176
|
|
|
} |
177
|
|
|
|
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..