1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Kunstmaan\AdminBundle\Entity; |
4
|
|
|
|
5
|
|
|
use DateTimeInterface; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* @ORM\Entity(repositoryClass="Kunstmaan\AdminBundle\Repository\ExceptionRepository") |
11
|
|
|
* @ORM\Table( |
12
|
|
|
* name="kuma_exception", |
13
|
|
|
* indexes={ |
14
|
|
|
* @ORM\Index(name="idx_exception_is_resolved", columns={"is_resolved"}) |
15
|
|
|
* } |
16
|
|
|
* ) |
17
|
|
|
* @UniqueEntity("hash") |
18
|
|
|
* @ORM\HasLifecycleCallbacks() |
19
|
|
|
*/ |
20
|
|
|
class Exception extends AbstractEntity |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* @var string |
24
|
|
|
* |
25
|
|
|
* @ORM\Column(type="string", length=3) |
26
|
|
|
*/ |
27
|
|
|
private $code; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* @var string |
31
|
|
|
* |
32
|
|
|
* @ORM\Column(type="text") |
33
|
|
|
*/ |
34
|
|
|
private $url; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @var string |
38
|
|
|
* |
39
|
|
|
* @ORM\Column(type="text", nullable=true) |
40
|
|
|
*/ |
41
|
|
|
private $urlReferer; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var string |
45
|
|
|
* |
46
|
|
|
* @ORM\Column(type="string", nullable=false, unique=true, length=32) |
47
|
|
|
*/ |
48
|
|
|
private $hash; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var int |
52
|
|
|
* |
53
|
|
|
* @ORM\Column(type="integer", nullable=false) |
54
|
|
|
*/ |
55
|
|
|
private $events; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var bool |
59
|
|
|
* |
60
|
|
|
* @ORM\Column(type="boolean", name="is_resolved") |
61
|
|
|
*/ |
62
|
|
|
private $isResolved; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @var \DateTime |
66
|
|
|
* |
67
|
|
|
* @ORM\Column(type="datetime", name="created_at") |
68
|
|
|
*/ |
69
|
|
|
private $createdAt; |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @var \DateTime |
73
|
|
|
* |
74
|
|
|
* @ORM\Column(type="datetime", name="updated_at") |
75
|
|
|
*/ |
76
|
|
|
private $updatedAt; |
77
|
|
|
|
78
|
|
|
public function __construct() |
79
|
|
|
{ |
80
|
|
|
$this->isResolved = false; |
81
|
|
|
$this->setCreatedAt(new \DateTime()); |
82
|
|
|
$this->setUpdatedAt(new \DateTime()); |
83
|
|
|
$this->setEvents(1); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @return string |
88
|
|
|
*/ |
89
|
|
|
public function getCode() |
90
|
|
|
{ |
91
|
|
|
return $this->code; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @param string $code |
96
|
|
|
*/ |
97
|
|
|
public function setCode($code) |
98
|
|
|
{ |
99
|
|
|
$this->code = $code; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @return string |
104
|
|
|
*/ |
105
|
|
|
public function getUrl() |
106
|
|
|
{ |
107
|
|
|
return $this->url; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* @param string $url |
112
|
|
|
*/ |
113
|
|
|
public function setUrl($url) |
114
|
|
|
{ |
115
|
|
|
$this->url = $url; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return string |
120
|
|
|
*/ |
121
|
|
|
public function getUrlReferer() |
122
|
|
|
{ |
123
|
|
|
return $this->urlReferer; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @param string $urlReferer |
128
|
|
|
*/ |
129
|
|
|
public function setUrlReferer($urlReferer) |
130
|
|
|
{ |
131
|
|
|
$this->urlReferer = $urlReferer; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @return string |
136
|
|
|
*/ |
137
|
|
|
public function getHash() |
138
|
|
|
{ |
139
|
|
|
return $this->hash; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* @param string $hash |
144
|
|
|
*/ |
145
|
|
|
public function setHash($hash) |
146
|
|
|
{ |
147
|
|
|
$this->hash = $hash; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
/** |
151
|
|
|
* @return int |
152
|
|
|
*/ |
153
|
|
|
public function getEvents() |
154
|
|
|
{ |
155
|
|
|
return $this->events; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* @param int $triggered |
|
|
|
|
160
|
|
|
*/ |
161
|
|
|
public function setEvents($events) |
162
|
|
|
{ |
163
|
|
|
$this->events = $events; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
public function increaseEvents() |
167
|
|
|
{ |
168
|
|
|
++$this->events; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* @return bool |
173
|
|
|
*/ |
174
|
|
|
public function isResolved() |
175
|
|
|
{ |
176
|
|
|
return (bool) $this->isResolved; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @param bool $isResolved |
181
|
|
|
*/ |
182
|
|
|
public function setResolved($isResolved) |
183
|
|
|
{ |
184
|
|
|
$this->isResolved = $isResolved; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @return \DateTime |
189
|
|
|
*/ |
190
|
|
|
public function getCreatedAt() |
191
|
|
|
{ |
192
|
|
|
return $this->createdAt; |
193
|
|
|
} |
194
|
|
|
|
195
|
|
|
/** |
196
|
|
|
* @param \DateTime $createdAt |
|
|
|
|
197
|
|
|
*/ |
198
|
|
|
public function setCreatedAt(DateTimeInterface $createdAt) |
199
|
|
|
{ |
200
|
|
|
$this->createdAt = $createdAt; |
|
|
|
|
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
/** |
204
|
|
|
* @return \DateTime |
205
|
|
|
*/ |
206
|
|
|
public function getUpdatedAt() |
207
|
|
|
{ |
208
|
|
|
return $this->updatedAt; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @param \DateTime $updatedAt |
|
|
|
|
213
|
|
|
*/ |
214
|
|
|
public function setUpdatedAt(DateTimeInterface $updatedAt) |
215
|
|
|
{ |
216
|
|
|
$this->updatedAt = $updatedAt; |
|
|
|
|
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @ORM\PreUpdate() |
221
|
|
|
*/ |
222
|
|
|
public function preUpdate() |
223
|
|
|
{ |
224
|
|
|
$this->setUpdatedAt(new \DateTime()); |
225
|
|
|
} |
226
|
|
|
} |
227
|
|
|
|
This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.
Consider the following example. The parameter
$italy
is not defined by the methodfinale(...)
.The most likely cause is that the parameter was removed, but the annotation was not.