1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PlaygroundGame\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
6
|
|
|
use Doctrine\ORM\Mapping as ORM; |
7
|
|
|
use Doctrine\ORM\Mapping\HasLifecycleCallbacks; |
8
|
|
|
use Doctrine\ORM\Mapping\PrePersist; |
9
|
|
|
use Doctrine\ORM\Mapping\PreUpdate; |
10
|
|
|
use Zend\InputFilter\InputFilter; |
11
|
|
|
use Zend\InputFilter\Factory as InputFactory; |
12
|
|
|
use Zend\InputFilter\InputFilterAwareInterface; |
13
|
|
|
use Zend\InputFilter\InputFilterInterface; |
14
|
|
|
use Gedmo\Mapping\Annotation as Gedmo; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* @ORM\Entity @HasLifecycleCallbacks |
18
|
|
|
* @ORM\Table(name="game_quiz_question") |
19
|
|
|
* @Gedmo\TranslationEntity(class="PlaygroundGame\Entity\QuizQuestionTranslation") |
20
|
|
|
*/ |
21
|
|
|
class QuizQuestion implements InputFilterAwareInterface |
22
|
|
|
{ |
23
|
|
|
protected $inputFilter; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @ORM\Id |
27
|
|
|
* @ORM\Column(type="integer"); |
28
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
29
|
|
|
*/ |
30
|
|
|
protected $id; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @ORM\ManyToOne(targetEntity="Quiz", inversedBy="questions", cascade={"persist"}) |
34
|
|
|
* @ORM\JoinColumn(name="quiz_id", referencedColumnName="id", onDelete="CASCADE") |
35
|
|
|
*/ |
36
|
|
|
protected $quiz; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @ORM\OneToMany(targetEntity="QuizAnswer", mappedBy="question", cascade={"persist","remove"}) |
40
|
|
|
*/ |
41
|
|
|
private $answers; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* values : |
45
|
|
|
* 0 : closed (you can select only one answer) |
46
|
|
|
* 1 : opened (you can select many answers), |
47
|
|
|
* 2: No answer to select. You write a text in a textarea |
48
|
|
|
* |
49
|
|
|
* @ORM\Column(type="integer", nullable=false) |
50
|
|
|
*/ |
51
|
|
|
protected $type = 0; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @Gedmo\Translatable |
55
|
|
|
* @ORM\Column(type="text", nullable=false) |
56
|
|
|
*/ |
57
|
|
|
protected $question; |
58
|
|
|
|
59
|
|
|
/** |
60
|
|
|
* @ORM\Column(type="integer", nullable=false) |
61
|
|
|
*/ |
62
|
|
|
protected $position = 0; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @Gedmo\Translatable |
66
|
|
|
* @ORM\Column(type="string", nullable=true) |
67
|
|
|
*/ |
68
|
|
|
protected $video; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @ORM\Column(type="string", nullable=true) |
72
|
|
|
*/ |
73
|
|
|
protected $image; |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @Gedmo\Translatable |
77
|
|
|
* @ORM\Column(type="integer", nullable=true) |
78
|
|
|
*/ |
79
|
|
|
protected $audio = 0; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @ORM\Column(type="boolean", nullable=true) |
83
|
|
|
*/ |
84
|
|
|
protected $autoplay = 0; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @Gedmo\Translatable |
88
|
|
|
* @ORM\Column(type="text", nullable=true) |
89
|
|
|
*/ |
90
|
|
|
protected $hint; |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @Gedmo\Translatable |
94
|
|
|
* @ORM\Column(name="json_data", type="text", nullable=true) |
95
|
|
|
*/ |
96
|
|
|
protected $jsonData; |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @ORM\Column(type="boolean", nullable=true) |
100
|
|
|
*/ |
101
|
|
|
protected $prediction = 0; |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @ORM\Column(type="boolean", nullable=true) |
105
|
|
|
*/ |
106
|
|
|
protected $timer = 0; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @ORM\Column(type="integer", nullable=true) |
110
|
|
|
*/ |
111
|
|
|
protected $timer_duration = 0; |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* The question weight in the game |
115
|
|
|
* @ORM\Column(type="integer", nullable=false) |
116
|
|
|
*/ |
117
|
|
|
protected $weight = 1; |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @ORM\Column(type="integer", nullable=true) |
121
|
|
|
*/ |
122
|
|
|
protected $max_points = 0; |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* @ORM\Column(type="integer", nullable=true) |
126
|
|
|
*/ |
127
|
|
|
protected $max_correct_answers = 0; |
128
|
|
|
|
129
|
|
|
/** |
130
|
|
|
* @ORM\Column(type="datetime") |
131
|
|
|
*/ |
132
|
|
|
protected $created_at; |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* @ORM\Column(type="datetime") |
136
|
|
|
*/ |
137
|
|
|
protected $updated_at; |
138
|
|
|
|
139
|
|
|
public function __construct() |
140
|
|
|
{ |
141
|
|
|
$this->answers = new ArrayCollection(); |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
/** |
145
|
|
|
* @PrePersist |
146
|
|
|
*/ |
147
|
|
|
public function createChrono() |
148
|
|
|
{ |
149
|
|
|
$this->created_at = new \DateTime("now"); |
150
|
|
|
$this->updated_at = new \DateTime("now"); |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* @PreUpdate |
155
|
|
|
*/ |
156
|
|
|
public function updateChrono() |
157
|
|
|
{ |
158
|
|
|
$this->updated_at = new \DateTime("now"); |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* @return the unknown_type |
163
|
|
|
*/ |
164
|
|
|
public function getId() |
165
|
|
|
{ |
166
|
|
|
return $this->id; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
/** |
170
|
|
|
* @param unknown_type $id |
171
|
|
|
*/ |
172
|
|
|
public function setId($id) |
173
|
|
|
{ |
174
|
|
|
$this->id = $id; |
175
|
|
|
|
176
|
|
|
return $this; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
/** |
180
|
|
|
* @return the unknown_type |
181
|
|
|
*/ |
182
|
|
|
public function getQuiz() |
183
|
|
|
{ |
184
|
|
|
return $this->quiz; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* @param unknown_type $quiz |
189
|
|
|
*/ |
190
|
|
|
public function setQuiz($quiz) |
191
|
|
|
{ |
192
|
|
|
$quiz->addQuestion($this); |
193
|
|
|
$this->quiz = $quiz; |
194
|
|
|
|
195
|
|
|
return $this; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* @return ArrayCollection unknown_type |
200
|
|
|
*/ |
201
|
|
|
public function getAnswers() |
202
|
|
|
{ |
203
|
|
|
return $this->answers; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* frm collection solution |
208
|
|
|
* @param ArrayCollection $answers |
209
|
|
|
*/ |
210
|
|
|
public function setAnswers(ArrayCollection $answers) |
211
|
|
|
{ |
212
|
|
|
$this->answers = $answers; |
213
|
|
|
|
214
|
|
|
return $this; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
public function addAnswers(ArrayCollection $answers) |
218
|
|
|
{ |
219
|
|
|
foreach ($answers as $answer) { |
220
|
|
|
$answer->setQuestion($this); |
221
|
|
|
$this->answers->add($answer); |
222
|
|
|
} |
223
|
|
|
} |
224
|
|
|
|
225
|
|
|
public function removeAnswers(ArrayCollection $answers) |
226
|
|
|
{ |
227
|
|
|
foreach ($answers as $answer) { |
228
|
|
|
$answer->setQuestion(null); |
229
|
|
|
$this->answers->removeElement($answer); |
230
|
|
|
} |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
/** |
234
|
|
|
* Add an answer to the quiz. |
235
|
|
|
* |
236
|
|
|
* @param QuizAnswer $answer |
237
|
|
|
* |
238
|
|
|
* @return void |
239
|
|
|
*/ |
240
|
|
|
public function addAnswer($answer) |
241
|
|
|
{ |
242
|
|
|
$this->answers[] = $answer; |
243
|
|
|
} |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* @return integer unknown_type |
247
|
|
|
*/ |
248
|
|
|
public function getType() |
249
|
|
|
{ |
250
|
|
|
return $this->type; |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
/** |
254
|
|
|
* @param unknown_type $type |
255
|
|
|
*/ |
256
|
|
|
public function setType($type) |
257
|
|
|
{ |
258
|
|
|
$this->type = $type; |
|
|
|
|
259
|
|
|
|
260
|
|
|
return $this; |
261
|
|
|
} |
262
|
|
|
|
263
|
|
|
/** |
264
|
|
|
* @return the unknown_type |
265
|
|
|
*/ |
266
|
|
|
public function getVideo() |
267
|
|
|
{ |
268
|
|
|
return $this->video; |
269
|
|
|
} |
270
|
|
|
|
271
|
|
|
/** |
272
|
|
|
* @param unknown_type $video |
273
|
|
|
*/ |
274
|
|
|
public function setVideo($video) |
275
|
|
|
{ |
276
|
|
|
$this->video = $video; |
277
|
|
|
|
278
|
|
|
return $this; |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
/** |
282
|
|
|
* @return the unknown_type |
283
|
|
|
*/ |
284
|
|
|
public function getImage() |
285
|
|
|
{ |
286
|
|
|
return $this->image; |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* @param string $image |
291
|
|
|
*/ |
292
|
|
|
public function setImage($image) |
293
|
|
|
{ |
294
|
|
|
$this->image = $image; |
295
|
|
|
|
296
|
|
|
return $this; |
297
|
|
|
} |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* @return integer unknown_type |
301
|
|
|
*/ |
302
|
|
|
public function getAudio() |
303
|
|
|
{ |
304
|
|
|
return $this->audio; |
305
|
|
|
} |
306
|
|
|
|
307
|
|
|
/** |
308
|
|
|
* @param unknown_type audio |
309
|
|
|
*/ |
310
|
|
|
public function setAudio($audio) |
311
|
|
|
{ |
312
|
|
|
$this->audio = $audio; |
313
|
|
|
|
314
|
|
|
return $this; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
/** |
318
|
|
|
* @return boolean unknown_type |
319
|
|
|
*/ |
320
|
|
|
public function getAutoplay() |
321
|
|
|
{ |
322
|
|
|
return $this->autoplay; |
323
|
|
|
} |
324
|
|
|
|
325
|
|
|
/** |
326
|
|
|
* @param unknown_type autoplay |
327
|
|
|
*/ |
328
|
|
|
public function setAutoplay($autoplay) |
329
|
|
|
{ |
330
|
|
|
$this->autoplay = $autoplay; |
331
|
|
|
|
332
|
|
|
return $this; |
333
|
|
|
} |
334
|
|
|
|
335
|
|
|
/** |
336
|
|
|
* @return the unknown_type |
337
|
|
|
*/ |
338
|
|
|
public function getHint() |
339
|
|
|
{ |
340
|
|
|
return $this->hint; |
341
|
|
|
} |
342
|
|
|
|
343
|
|
|
/** |
344
|
|
|
* @param unknown_type $hint |
345
|
|
|
*/ |
346
|
|
|
public function setHint($hint) |
347
|
|
|
{ |
348
|
|
|
$this->hint = $hint; |
349
|
|
|
|
350
|
|
|
return $this; |
351
|
|
|
} |
352
|
|
|
|
353
|
|
|
/** |
354
|
|
|
* @return the string |
355
|
|
|
*/ |
356
|
|
|
public function getJsonData() |
357
|
|
|
{ |
358
|
|
|
return $this->jsonData; |
359
|
|
|
} |
360
|
|
|
|
361
|
|
|
/** |
362
|
|
|
* @param string $hint |
|
|
|
|
363
|
|
|
*/ |
364
|
|
|
public function setJsonData($jsonData) |
365
|
|
|
{ |
366
|
|
|
$this->jsonData = $jsonData; |
367
|
|
|
|
368
|
|
|
return $this; |
369
|
|
|
} |
370
|
|
|
|
371
|
|
|
/** |
372
|
|
|
* @return boolean unknown_type |
373
|
|
|
*/ |
374
|
|
|
public function getTimer() |
375
|
|
|
{ |
376
|
|
|
return $this->timer; |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
/** |
380
|
|
|
* @param unknown_type $timer |
381
|
|
|
*/ |
382
|
|
|
public function setTimer($timer) |
383
|
|
|
{ |
384
|
|
|
$this->timer = $timer; |
|
|
|
|
385
|
|
|
|
386
|
|
|
return $this; |
387
|
|
|
} |
388
|
|
|
|
389
|
|
|
/** |
390
|
|
|
* @return integer unknown_type |
391
|
|
|
*/ |
392
|
|
|
public function getPrediction() |
393
|
|
|
{ |
394
|
|
|
return $this->prediction; |
395
|
|
|
} |
396
|
|
|
|
397
|
|
|
/** |
398
|
|
|
* @param unknown_type $prediction |
399
|
|
|
*/ |
400
|
|
|
public function setPrediction($prediction) |
401
|
|
|
{ |
402
|
|
|
$this->prediction = $prediction; |
|
|
|
|
403
|
|
|
|
404
|
|
|
return $this; |
405
|
|
|
} |
406
|
|
|
|
407
|
|
|
/** |
408
|
|
|
* @return integer unknown_type |
409
|
|
|
*/ |
410
|
|
|
public function getTimerDuration() |
411
|
|
|
{ |
412
|
|
|
return $this->timer_duration; |
413
|
|
|
} |
414
|
|
|
|
415
|
|
|
/** |
416
|
|
|
* @param unknown_type $timer_duration |
417
|
|
|
*/ |
418
|
|
|
public function setTimerDuration($timer_duration) |
419
|
|
|
{ |
420
|
|
|
$this->timer_duration = $timer_duration; |
|
|
|
|
421
|
|
|
|
422
|
|
|
return $this; |
423
|
|
|
} |
424
|
|
|
|
425
|
|
|
/** |
426
|
|
|
* @return integer unknown_type |
427
|
|
|
*/ |
428
|
|
|
public function getWeight() |
429
|
|
|
{ |
430
|
|
|
return $this->weight; |
431
|
|
|
} |
432
|
|
|
|
433
|
|
|
/** |
434
|
|
|
* @param unknown_type $weight |
435
|
|
|
*/ |
436
|
|
|
public function setWeight($weight) |
437
|
|
|
{ |
438
|
|
|
$this->weight = $weight; |
|
|
|
|
439
|
|
|
|
440
|
|
|
return $this; |
441
|
|
|
} |
442
|
|
|
|
443
|
|
|
/** |
444
|
|
|
* @return integer |
445
|
|
|
*/ |
446
|
|
|
public function getMaxPoints() |
447
|
|
|
{ |
448
|
|
|
return $this->max_points; |
449
|
|
|
} |
450
|
|
|
|
451
|
|
|
/** |
452
|
|
|
* @param integer max_points |
453
|
|
|
*/ |
454
|
|
|
public function setMaxPoints($max_points) |
455
|
|
|
{ |
456
|
|
|
$this->max_points = $max_points; |
457
|
|
|
|
458
|
|
|
return $this; |
459
|
|
|
} |
460
|
|
|
|
461
|
|
|
/** |
462
|
|
|
* @return integer |
463
|
|
|
*/ |
464
|
|
|
public function getMaxCorrectAnswers() |
465
|
|
|
{ |
466
|
|
|
return $this->max_correct_answers; |
467
|
|
|
} |
468
|
|
|
|
469
|
|
|
/** |
470
|
|
|
* @param integer max_correct_answers |
471
|
|
|
*/ |
472
|
|
|
public function setMaxCorrectAnswers($max_correct_answers) |
473
|
|
|
{ |
474
|
|
|
$this->max_correct_answers = $max_correct_answers; |
475
|
|
|
|
476
|
|
|
return $this; |
477
|
|
|
} |
478
|
|
|
|
479
|
|
|
/** |
480
|
|
|
* @return the unknown_type |
481
|
|
|
*/ |
482
|
|
|
public function getCreatedAt() |
483
|
|
|
{ |
484
|
|
|
return $this->created_at; |
485
|
|
|
} |
486
|
|
|
|
487
|
|
|
/** |
488
|
|
|
* @param unknown_type $created_at |
489
|
|
|
*/ |
490
|
|
|
public function setCreatedAt($created_at) |
491
|
|
|
{ |
492
|
|
|
$this->created_at = $created_at; |
493
|
|
|
|
494
|
|
|
return $this; |
495
|
|
|
} |
496
|
|
|
|
497
|
|
|
/** |
498
|
|
|
* @return the unknown_type |
499
|
|
|
*/ |
500
|
|
|
public function getUpdatedAt() |
501
|
|
|
{ |
502
|
|
|
return $this->updated_at; |
503
|
|
|
} |
504
|
|
|
|
505
|
|
|
/** |
506
|
|
|
* @param unknown_type $updated_at |
507
|
|
|
*/ |
508
|
|
|
public function setUpdatedAt($updated_at) |
509
|
|
|
{ |
510
|
|
|
$this->updated_at = $updated_at; |
511
|
|
|
|
512
|
|
|
return $this; |
513
|
|
|
} |
514
|
|
|
|
515
|
|
|
/** |
516
|
|
|
* @return string |
517
|
|
|
*/ |
518
|
|
|
public function getQuestion() |
519
|
|
|
{ |
520
|
|
|
return $this->question; |
521
|
|
|
} |
522
|
|
|
|
523
|
|
|
/** |
524
|
|
|
* @param string $question |
525
|
|
|
*/ |
526
|
|
|
public function setQuestion($question) |
527
|
|
|
{ |
528
|
|
|
$this->question = $question; |
529
|
|
|
|
530
|
|
|
return $this; |
531
|
|
|
} |
532
|
|
|
|
533
|
|
|
/** |
534
|
|
|
* @return integer |
535
|
|
|
*/ |
536
|
|
|
public function getPosition() |
537
|
|
|
{ |
538
|
|
|
return $this->position; |
539
|
|
|
} |
540
|
|
|
|
541
|
|
|
/** |
542
|
|
|
* @param string $position |
543
|
|
|
*/ |
544
|
|
|
public function setPosition($position) |
545
|
|
|
{ |
546
|
|
|
$this->position = $position; |
|
|
|
|
547
|
|
|
|
548
|
|
|
return $this; |
549
|
|
|
} |
550
|
|
|
|
551
|
|
|
/** |
552
|
|
|
* Convert the object to an array. |
553
|
|
|
* |
554
|
|
|
* @return array |
555
|
|
|
*/ |
556
|
|
|
public function getArrayCopy() |
557
|
|
|
{ |
558
|
|
|
$obj_vars = get_object_vars($this); |
559
|
|
|
|
560
|
|
|
return $obj_vars; |
561
|
|
|
} |
562
|
|
|
|
563
|
|
|
/** |
564
|
|
|
* Populate from an array. |
565
|
|
|
* |
566
|
|
|
* @param array $data |
567
|
|
|
*/ |
568
|
|
|
public function populate($data = array()) |
569
|
|
|
{ |
570
|
|
|
if (isset($data['question']) && $data['question'] !== null) { |
571
|
|
|
$this->question = $data['question']; |
572
|
|
|
} |
573
|
|
|
|
574
|
|
View Code Duplication |
if (isset($data['hint']) && $data['hint'] !== null) { |
|
|
|
|
575
|
|
|
$this->hint = $data['hint']; |
576
|
|
|
} |
577
|
|
|
|
578
|
|
View Code Duplication |
if (isset($data['jsonData']) && $data['jsonData'] !== null) { |
|
|
|
|
579
|
|
|
$this->jsonData = $data['jsonData']; |
580
|
|
|
} |
581
|
|
|
|
582
|
|
View Code Duplication |
if (isset($data['type']) && $data['type'] !== null) { |
|
|
|
|
583
|
|
|
$this->type = $data['type']; |
584
|
|
|
} |
585
|
|
|
|
586
|
|
View Code Duplication |
if (isset($data['position']) && $data['position'] !== null) { |
|
|
|
|
587
|
|
|
$this->position = $data['position']; |
588
|
|
|
} |
589
|
|
|
|
590
|
|
|
if (isset($data['weight']) && $data['weight'] !== null) { |
591
|
|
|
$this->weight = $data['weight']; |
592
|
|
|
} |
593
|
|
|
|
594
|
|
View Code Duplication |
if (isset($data['image']) && $data['image'] !== null) { |
|
|
|
|
595
|
|
|
$this->image = $data['image']; |
596
|
|
|
} |
597
|
|
|
|
598
|
|
View Code Duplication |
if (isset($data['video']) && $data['video'] !== null) { |
|
|
|
|
599
|
|
|
$this->video = $data['video']; |
600
|
|
|
} |
601
|
|
|
|
602
|
|
|
if (isset($data['audio']) && $data['audio'] !== null) { |
603
|
|
|
$this->audio = $data['audio']; |
604
|
|
|
} |
605
|
|
|
|
606
|
|
|
if (isset($data['autoplay']) && $data['autoplay'] !== null) { |
607
|
|
|
$this->autoplay = $data['autoplay']; |
608
|
|
|
} |
609
|
|
|
|
610
|
|
View Code Duplication |
if (isset($data['timer']) && $data['timer'] !== null) { |
|
|
|
|
611
|
|
|
$this->timer = $data['timer']; |
612
|
|
|
} |
613
|
|
|
|
614
|
|
|
if (isset($data['timer_duration']) && $data['timer_duration'] !== null) { |
615
|
|
|
$this->timer_duration = $data['timer_duration']; |
616
|
|
|
} |
617
|
|
|
|
618
|
|
|
if (isset($data['max_points']) && $data['max_points'] !== null) { |
619
|
|
|
$this->max_points = $data['max_points']; |
620
|
|
|
} |
621
|
|
|
|
622
|
|
|
if (isset($data['max_correct_answers']) && $data['max_correct_answers'] !== null) { |
623
|
|
|
$this->max_correct_answers = $data['max_correct_answers']; |
624
|
|
|
} |
625
|
|
|
} |
626
|
|
|
|
627
|
|
|
public function setInputFilter(InputFilterInterface $inputFilter) |
628
|
|
|
{ |
629
|
|
|
throw new \Exception("Not used"); |
630
|
|
|
} |
631
|
|
|
|
632
|
|
|
public function getInputFilter() |
633
|
|
|
{ |
634
|
|
|
if (!$this->inputFilter) { |
635
|
|
|
$inputFilter = new InputFilter(); |
636
|
|
|
$factory = new InputFactory(); |
637
|
|
|
|
638
|
|
|
$inputFilter->add($factory->createInput(array( |
639
|
|
|
'name' => 'id', |
640
|
|
|
'required' => false, |
641
|
|
|
'allowEmpty' => true, |
642
|
|
|
'filters' => array( |
643
|
|
|
array('name' => 'Int'), |
644
|
|
|
), |
645
|
|
|
))); |
646
|
|
|
|
647
|
|
|
$inputFilter->add($factory->createInput(array( |
648
|
|
|
'name' => 'prediction', |
649
|
|
|
'required' => false, |
650
|
|
|
'allowEmpty' => true, |
651
|
|
|
// 'filters' => array( |
652
|
|
|
// array('name' => 'Boolean'), |
653
|
|
|
// ), |
654
|
|
|
))); |
655
|
|
|
|
656
|
|
|
$inputFilter->add($factory->createInput(array( |
657
|
|
|
'name' => 'question', |
658
|
|
|
'required' => true, |
659
|
|
|
))); |
660
|
|
|
|
661
|
|
|
$inputFilter->add($factory->createInput(array( |
662
|
|
|
'name' => 'max_correct_answers', |
663
|
|
|
'required' => false, |
664
|
|
|
'allowEmpty' => true, |
665
|
|
|
'filters' => array( |
666
|
|
|
array('name' => 'Int'), |
667
|
|
|
), |
668
|
|
|
'validators' => array( |
669
|
|
|
array( |
670
|
|
|
'name' => 'Digits', |
671
|
|
|
), |
672
|
|
|
), |
673
|
|
|
))); |
674
|
|
|
|
675
|
|
|
$inputFilter->add($factory->createInput(array( |
676
|
|
|
'name' => 'hint', |
677
|
|
|
'required' => false, |
678
|
|
|
/*'filters' => array( |
679
|
|
|
array('name' => 'StringTrim'), |
680
|
|
|
), |
681
|
|
|
'validators' => array( |
682
|
|
|
array( |
683
|
|
|
'name' => 'StringLength', |
684
|
|
|
'options' => array( |
685
|
|
|
'encoding' => 'UTF-8', |
686
|
|
|
'min' => 1, |
687
|
|
|
'max' => 255, |
688
|
|
|
), |
689
|
|
|
), |
690
|
|
|
),*/ |
691
|
|
|
))); |
692
|
|
|
|
693
|
|
|
$inputFilter->add($factory->createInput(array( |
694
|
|
|
'name' => 'timer', |
695
|
|
|
'required' => false, |
696
|
|
|
'allowEmpty' => true, |
697
|
|
|
// 'filters' => array( |
698
|
|
|
// array('name' => 'Boolean'), |
699
|
|
|
// ), |
700
|
|
|
))); |
701
|
|
|
|
702
|
|
|
$inputFilter->add($factory->createInput(array( |
703
|
|
|
'name' => 'jsonData', |
704
|
|
|
'required' => false, |
705
|
|
|
'allowEmpty' => true, |
706
|
|
|
))); |
707
|
|
|
|
708
|
|
|
$inputFilter->add($factory->createInput(array( |
709
|
|
|
'name' => 'type', |
710
|
|
|
'required' => true, |
711
|
|
|
'validators' => array( |
712
|
|
|
array( |
713
|
|
|
'name' => 'Between', |
714
|
|
|
'options' => array( |
715
|
|
|
'min' => 0, |
716
|
|
|
'max' => 2, |
717
|
|
|
), |
718
|
|
|
), |
719
|
|
|
), |
720
|
|
|
))); |
721
|
|
|
|
722
|
|
|
$inputFilter->add($factory->createInput(array( |
723
|
|
|
'name' => 'image', |
724
|
|
|
'required' => false, |
725
|
|
|
))); |
726
|
|
|
|
727
|
|
|
$inputFilter->add($factory->createInput(array( |
728
|
|
|
'name' => 'audio', |
729
|
|
|
'required' => false, |
730
|
|
|
'filters' => array( |
731
|
|
|
array('name' => 'Int') |
732
|
|
|
), |
733
|
|
|
))); |
734
|
|
|
|
735
|
|
|
$inputFilter->add($factory->createInput(array( |
736
|
|
|
'name' => 'autoplay', |
737
|
|
|
'required' => false, |
738
|
|
|
'allowEmpty' => true, |
739
|
|
|
// 'filters' => array( |
740
|
|
|
// array('name' => 'Boolean'), |
741
|
|
|
// ), |
742
|
|
|
))); |
743
|
|
|
|
744
|
|
|
$this->inputFilter = $inputFilter; |
745
|
|
|
} |
746
|
|
|
|
747
|
|
|
return $this->inputFilter; |
748
|
|
|
} |
749
|
|
|
} |
750
|
|
|
|
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..