1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace KI\UserBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use JMS\Serializer\Annotation as JMS; |
7
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Stocke un commentaire utilisateur |
11
|
|
|
* @ORM\Entity(repositoryClass="KI\UserBundle\Repository\FacegameRepository") |
12
|
|
|
* @JMS\ExclusionPolicy("all") |
13
|
|
|
*/ |
14
|
|
|
class Facegame |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @ORM\Id |
18
|
|
|
* @ORM\Column(type="integer") |
19
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
20
|
|
|
* @JMS\Expose |
21
|
|
|
*/ |
22
|
|
|
protected $id; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Date |
26
|
|
|
* @ORM\Column(name="date", type="integer") |
27
|
|
|
* @JMS\Expose |
28
|
|
|
* @Assert\Type("integer") |
29
|
|
|
*/ |
30
|
|
|
protected $date; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Durée du jeu |
34
|
|
|
* @ORM\Column(name="duration", type="integer", nullable = true) |
35
|
|
|
* @JMS\Expose |
36
|
|
|
* @Assert\Type("integer") |
37
|
|
|
*/ |
38
|
|
|
protected $duration; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Nombre de réponses fausses |
42
|
|
|
* @ORM\Column(name="wrongAnswers", type="integer", nullable=true) |
43
|
|
|
* @JMS\Expose |
44
|
|
|
* @Assert\Type("integer") |
45
|
|
|
*/ |
46
|
|
|
protected $wrongAnswers; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Joueur |
50
|
|
|
* @ORM\ManyToOne(targetEntity="KI\UserBundle\Entity\User", cascade={"persist"}) |
51
|
|
|
* @JMS\Expose |
52
|
|
|
*/ |
53
|
|
|
protected $user; |
54
|
|
|
public $autoSetUser = 'user'; |
55
|
|
|
public function getAutoSetUser() { return $this->autoSetUser; } |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* Liste des utilisateurs représentés dans le jeu |
59
|
|
|
* @ORM\Column(name="listUsers", type="array") |
60
|
|
|
* @JMS\Expose |
61
|
|
|
* @Assert\Type("array") |
62
|
|
|
*/ |
63
|
|
|
protected $listUsers; |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Promo |
67
|
|
|
* @ORM\Column(name="promo", type="string", nullable = true) |
68
|
|
|
* @JMS\Expose |
69
|
|
|
* @Assert\Type("string") |
70
|
|
|
*/ |
71
|
|
|
protected $promo; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Promo |
75
|
|
|
* @ORM\Column(name="hardcore", type="boolean", nullable = true) |
76
|
|
|
* @JMS\Expose |
77
|
|
|
* @Assert\Type("boolean") |
78
|
|
|
*/ |
79
|
|
|
protected $hardcore; |
80
|
|
|
|
81
|
|
|
public function __construct() |
82
|
|
|
{ |
83
|
|
|
$this->date = time(); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function getSlug() { return $this->getId(); } |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Get id |
90
|
|
|
* |
91
|
|
|
* @return integer |
92
|
|
|
*/ |
93
|
|
|
public function getId() |
94
|
|
|
{ |
95
|
|
|
return $this->id; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* Set date |
100
|
|
|
* |
101
|
|
|
* @param integer $date |
102
|
|
|
* |
103
|
|
|
* @return Facegame |
104
|
|
|
*/ |
105
|
|
|
public function setDate($date) |
106
|
|
|
{ |
107
|
|
|
$this->date = $date; |
108
|
|
|
|
109
|
|
|
return $this; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* Get duration |
114
|
|
|
* |
115
|
|
|
* @return integer |
116
|
|
|
*/ |
117
|
|
|
public function getDuration() |
118
|
|
|
{ |
119
|
|
|
return $this->duration; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* Set duration |
124
|
|
|
* |
125
|
|
|
* @param integer $duration |
126
|
|
|
* |
127
|
|
|
* @return Facegame |
128
|
|
|
*/ |
129
|
|
|
public function setDuration($duration) |
130
|
|
|
{ |
131
|
|
|
$this->duration = $duration; |
132
|
|
|
|
133
|
|
|
return $this; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
/** |
137
|
|
|
* Get wrongAnswers |
138
|
|
|
* |
139
|
|
|
* @return integer |
140
|
|
|
*/ |
141
|
|
|
public function getWrongAnswers() |
142
|
|
|
{ |
143
|
|
|
return $this->wrongAnswers; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Set wrongAnswers |
148
|
|
|
* |
149
|
|
|
* @param integer $wrongAnswers |
150
|
|
|
* |
151
|
|
|
* @return Facegame |
152
|
|
|
*/ |
153
|
|
|
public function setWrongAnswers($wrongAnswers) |
154
|
|
|
{ |
155
|
|
|
$this->wrongAnswers = $wrongAnswers; |
156
|
|
|
|
157
|
|
|
return $this; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
/** |
161
|
|
|
* Get date |
162
|
|
|
* |
163
|
|
|
* @return integer |
164
|
|
|
*/ |
165
|
|
|
public function getDate() |
166
|
|
|
{ |
167
|
|
|
return $this->date; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
/** |
171
|
|
|
* Set listUsers |
172
|
|
|
* |
173
|
|
|
* @param array $listUsers |
174
|
|
|
* |
175
|
|
|
* @return Facegame |
176
|
|
|
*/ |
177
|
|
|
public function setListUsers($listUsers) |
178
|
|
|
{ |
179
|
|
|
$this->listUsers = $listUsers; |
180
|
|
|
|
181
|
|
|
return $this; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Get listUsers |
186
|
|
|
* |
187
|
|
|
* @return array |
188
|
|
|
*/ |
189
|
|
|
public function getListUsers() |
190
|
|
|
{ |
191
|
|
|
return $this->listUsers; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* Set promo |
196
|
|
|
* |
197
|
|
|
* @param string $promo |
198
|
|
|
* |
199
|
|
|
* @return Facegame |
200
|
|
|
*/ |
201
|
|
|
public function setPromo($promo) |
202
|
|
|
{ |
203
|
|
|
$this->promo = $promo; |
204
|
|
|
|
205
|
|
|
return $this; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* Get promo |
210
|
|
|
* |
211
|
|
|
* @return string |
212
|
|
|
*/ |
213
|
|
|
public function getPromo() |
214
|
|
|
{ |
215
|
|
|
return $this->promo; |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* Set mode |
220
|
|
|
* |
221
|
|
|
* @param boolean $hardcore |
222
|
|
|
* |
223
|
|
|
* @return Facegame |
224
|
|
|
*/ |
225
|
|
|
public function setHardcore($hardcore) |
226
|
|
|
{ |
227
|
|
|
$this->hardcore = $hardcore; |
228
|
|
|
|
229
|
|
|
return $this; |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
/** |
233
|
|
|
* Get mode |
234
|
|
|
* |
235
|
|
|
* @return boolean |
236
|
|
|
*/ |
237
|
|
|
public function getHardcore() |
238
|
|
|
{ |
239
|
|
|
return $this->hardcore; |
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
/** |
243
|
|
|
* Set user |
244
|
|
|
* |
245
|
|
|
* @param \KI\UserBundle\Entity\User $user |
246
|
|
|
* |
247
|
|
|
* @return Facegame |
248
|
|
|
*/ |
249
|
|
|
public function setUser(\KI\UserBundle\Entity\User $user = null) |
250
|
|
|
{ |
251
|
|
|
$this->user = $user; |
252
|
|
|
|
253
|
|
|
return $this; |
254
|
|
|
} |
255
|
|
|
|
256
|
|
|
/** |
257
|
|
|
* Get user |
258
|
|
|
* |
259
|
|
|
* @return \KI\UserBundle\Entity\User |
260
|
|
|
*/ |
261
|
|
|
public function getUser() |
262
|
|
|
{ |
263
|
|
|
return $this->user; |
264
|
|
|
} |
265
|
|
|
} |
266
|
|
|
|