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