1
|
|
|
<?php |
2
|
|
|
namespace PlaygroundGame\Entity; |
3
|
|
|
|
4
|
|
|
use Doctrine\ORM\Mapping as ORM; |
5
|
|
|
use Doctrine\ORM\Mapping\HasLifecycleCallbacks; |
6
|
|
|
use Doctrine\ORM\Mapping\PrePersist; |
7
|
|
|
use Doctrine\ORM\Mapping\PreUpdate; |
8
|
|
|
use Zend\InputFilter\InputFilter; |
9
|
|
|
use Zend\InputFilter\InputFilterAwareInterface; |
10
|
|
|
use Zend\InputFilter\InputFilterInterface; |
11
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @ORM\Entity @HasLifecycleCallbacks |
14
|
|
|
* @ORM\Table(name="game_postvote_vote") |
15
|
|
|
*/ |
16
|
|
|
class PostVoteVote implements InputFilterAwareInterface |
17
|
|
|
{ |
18
|
|
|
protected $inputFilter; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* @ORM\Id |
22
|
|
|
* @ORM\Column(type="integer"); |
23
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
24
|
|
|
*/ |
25
|
|
|
protected $id; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @ORM\ManyToOne(targetEntity="PostVotePost", inversedBy="votes") |
29
|
|
|
* @ORM\JoinColumn(name="post_id", referencedColumnName="id", onDelete="CASCADE") |
30
|
|
|
**/ |
31
|
|
|
protected $post; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @ORM\ManyToOne(targetEntity="PostVote") |
35
|
|
|
**/ |
36
|
|
|
protected $postvote; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @ORM\ManyToOne(targetEntity="PlaygroundUser\Entity\User") |
40
|
|
|
* @ORM\JoinColumn(name="user_id", referencedColumnName="user_id", onDelete="CASCADE") |
41
|
|
|
*/ |
42
|
|
|
protected $user; |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @ORM\Column(type="text", nullable=true) |
46
|
|
|
*/ |
47
|
|
|
protected $ip; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @ORM\Column(type="text", nullable=true) |
51
|
|
|
*/ |
52
|
|
|
protected $message; |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @ORM\Column(type="string", nullable=true) |
56
|
|
|
*/ |
57
|
|
|
protected $note; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @ORM\Column(name="created_at", type="datetime") |
61
|
|
|
*/ |
62
|
|
|
protected $createdAt; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @ORM\Column(name="updated_at", type="datetime") |
66
|
|
|
*/ |
67
|
|
|
protected $updatedAt; |
68
|
|
|
|
69
|
|
|
/** @PrePersist */ |
70
|
|
|
public function createChrono() |
71
|
|
|
{ |
72
|
|
|
$this->createdAt = new \DateTime("now"); |
73
|
|
|
$this->updatedAt = new \DateTime("now"); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** @PreUpdate */ |
77
|
|
|
public function updateChrono() |
78
|
|
|
{ |
79
|
|
|
$this->updatedAt = new \DateTime("now"); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @return the unknown_type |
84
|
|
|
*/ |
85
|
|
|
public function getId() |
86
|
|
|
{ |
87
|
|
|
return $this->id; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @param unknown_type $id |
92
|
|
|
*/ |
93
|
|
|
public function setId($id) |
94
|
|
|
{ |
95
|
|
|
$this->id = $id; |
96
|
|
|
|
97
|
|
|
return $this; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @return string unknown_type |
102
|
|
|
*/ |
103
|
|
|
public function getIp() |
104
|
|
|
{ |
105
|
|
|
return $this->ip; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @param string $ip |
110
|
|
|
*/ |
111
|
|
|
public function setIp($ip) |
112
|
|
|
{ |
113
|
|
|
$this->ip = $ip; |
114
|
|
|
|
115
|
|
|
return $this; |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
/** |
119
|
|
|
* @return the unknown_type |
120
|
|
|
*/ |
121
|
|
|
public function getUser() |
122
|
|
|
{ |
123
|
|
|
return $this->user; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* @param unknown_type $user |
128
|
|
|
*/ |
129
|
|
|
public function setUser($user) |
130
|
|
|
{ |
131
|
|
|
$this->user = $user; |
132
|
|
|
|
133
|
|
|
return $this; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* @return the unknown_type |
138
|
|
|
*/ |
139
|
|
|
public function getPost() |
140
|
|
|
{ |
141
|
|
|
return $this->post; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @param unknown_type $post |
146
|
|
|
*/ |
147
|
|
|
public function setPost($post) |
148
|
|
|
{ |
149
|
|
|
// Check that there is no drawback using the cascading update from PostVoteEntry |
150
|
|
|
$post->addVote($this); |
151
|
|
|
$this->post = $post; |
152
|
|
|
|
153
|
|
|
return $this; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @return the unknown_type |
158
|
|
|
*/ |
159
|
|
|
public function getPostvote() |
160
|
|
|
{ |
161
|
|
|
return $this->postvote; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
/** |
165
|
|
|
* @param unknown_type $postvote |
166
|
|
|
*/ |
167
|
|
|
public function setPostvote($postvote) |
168
|
|
|
{ |
169
|
|
|
|
170
|
|
|
$this->postvote = $postvote; |
171
|
|
|
|
172
|
|
|
return $this; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
/** |
176
|
|
|
* @return the unknown_type |
177
|
|
|
*/ |
178
|
|
|
public function getMessage() |
179
|
|
|
{ |
180
|
|
|
return $this->message; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
/** |
184
|
|
|
* @param unknown_type $message |
185
|
|
|
*/ |
186
|
|
|
public function setMessage($message) |
187
|
|
|
{ |
188
|
|
|
$this->message = $message; |
189
|
|
|
|
190
|
|
|
return $this; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
/** |
194
|
|
|
* @return the unknown_type |
195
|
|
|
*/ |
196
|
|
|
public function getNote() |
197
|
|
|
{ |
198
|
|
|
return $this->note; |
199
|
|
|
} |
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* @param unknown_type $note |
203
|
|
|
*/ |
204
|
|
|
public function setNote($note) |
205
|
|
|
{ |
206
|
|
|
$this->note = $note; |
207
|
|
|
|
208
|
|
|
return $this; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
/** |
212
|
|
|
* @return the unknown_type |
213
|
|
|
*/ |
214
|
|
|
public function getCreatedAt() |
215
|
|
|
{ |
216
|
|
|
return $this->createdAt; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* @param unknown_type $createdAt |
221
|
|
|
*/ |
222
|
|
|
public function setCreatedAt($createdAt) |
223
|
|
|
{ |
224
|
|
|
$this->createdAt = $createdAt; |
225
|
|
|
|
226
|
|
|
return $this; |
227
|
|
|
} |
228
|
|
|
|
229
|
|
|
/** |
230
|
|
|
* @return the unknown_type |
231
|
|
|
*/ |
232
|
|
|
public function getUpdatedAt() |
233
|
|
|
{ |
234
|
|
|
return $this->updatedAt; |
235
|
|
|
} |
236
|
|
|
|
237
|
|
|
/** |
238
|
|
|
* @param unknown_type $updatedAt |
239
|
|
|
*/ |
240
|
|
|
public function setUpdatedAt($updatedAt) |
241
|
|
|
{ |
242
|
|
|
$this->updatedAt = $updatedAt; |
243
|
|
|
|
244
|
|
|
return $this; |
245
|
|
|
} |
246
|
|
|
|
247
|
|
|
/** |
248
|
|
|
* Convert the object to an array. |
249
|
|
|
* |
250
|
|
|
* @return array |
251
|
|
|
*/ |
252
|
|
|
public function getArrayCopy() |
253
|
|
|
{ |
254
|
|
|
$obj_vars = get_object_vars($this); |
255
|
|
|
|
256
|
|
|
return $obj_vars; |
257
|
|
|
} |
258
|
|
|
|
259
|
|
|
/** |
260
|
|
|
* Populate from an array. |
261
|
|
|
* |
262
|
|
|
* @param array $data |
263
|
|
|
*/ |
264
|
|
|
public function populate($data = array()) |
|
|
|
|
265
|
|
|
{ |
266
|
|
|
} |
267
|
|
|
|
268
|
|
|
public function setInputFilter(InputFilterInterface $inputFilter) |
269
|
|
|
{ |
270
|
|
|
throw new \Exception("Not used"); |
271
|
|
|
} |
272
|
|
|
|
273
|
|
|
public function getInputFilter() |
274
|
|
|
{ |
275
|
|
|
if (!$this->inputFilter) { |
276
|
|
|
$inputFilter = new InputFilter(); |
277
|
|
|
|
278
|
|
|
$this->inputFilter = $inputFilter; |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
return $this->inputFilter; |
282
|
|
|
} |
283
|
|
|
} |
284
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.