Passed
Push — master ( 251179...3b9d17 )
by Julito
09:58
created

CSurveyQuestion   A

Complexity

Total Complexity 35

Size/Duplication

Total Lines 425
Duplicated Lines 0 %

Importance

Changes 4
Bugs 1 Features 2
Metric Value
eloc 74
dl 0
loc 425
rs 9.6
c 4
b 1
f 2
wmc 35

35 Methods

Rating   Name   Duplication   Size   Complexity  
A getDisplay() 0 3 1
A setDisplay() 0 5 1
A getIid() 0 3 1
A __construct() 0 7 1
A setMaxValue() 0 5 1
A setSort() 0 5 1
A setType() 0 5 1
A setChildren() 0 5 1
A getSurveyGroupSec1() 0 3 1
A isMandatory() 0 3 1
A setIsMandatory() 0 5 1
A setSurveyGroupSec2() 0 5 1
A getSharedQuestionId() 0 3 1
A setParent() 0 5 1
A getSort() 0 3 1
A setSurveyQuestionComment() 0 5 1
A getChildren() 0 3 1
A getMaxValue() 0 3 1
A setCId() 0 5 1
A setSurveyGroupSec1() 0 5 1
A getSurveyQuestion() 0 3 1
A getSurvey() 0 3 1
A getCId() 0 3 1
A setParentOption() 0 5 1
A getAnswers() 0 3 1
A getParentOption() 0 3 1
A setSurveyGroupPri() 0 5 1
A getSurveyQuestionComment() 0 3 1
A getSurveyGroupSec2() 0 3 1
A getType() 0 3 1
A setSharedQuestionId() 0 5 1
A setSurveyQuestion() 0 5 1
A setSurvey() 0 5 1
A getParent() 0 3 1
A getSurveyGroupPri() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CourseBundle\Entity;
8
9
use Doctrine\Common\Collections\ArrayCollection;
10
use Doctrine\Common\Collections\Collection;
11
use Doctrine\ORM\Mapping as ORM;
12
use Symfony\Component\Validator\Constraints as Assert;
13
14
/**
15
 * CSurveyQuestion.
16
 *
17
 * @ORM\Table(
18
 *     name="c_survey_question",
19
 *     indexes={
20
 *         @ORM\Index(name="course", columns={"c_id"}),
21
 *     }
22
 * )
23
 * @ORM\Entity
24
 */
25
class CSurveyQuestion
26
{
27
    /**
28
     * @ORM\Column(name="iid", type="integer")
29
     * @ORM\Id
30
     * @ORM\GeneratedValue
31
     */
32
    protected int $iid;
33
34
    /**
35
     * @ORM\ManyToOne(targetEntity="CSurveyQuestion", inversedBy="children")
36
     * @ORM\JoinColumn(name="parent_id", referencedColumnName="iid")
37
     */
38
    protected ?CSurveyQuestion $parent = null;
39
40
    /**
41
     * @var Collection|CSurveyQuestion[]
42
     * @ORM\OneToMany(targetEntity="CSurveyQuestion", mappedBy="parentEvent")
43
     */
44
    protected Collection $children;
45
46
    /**
47
     * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CSurveyQuestionOption", cascade="remove")
48
     * @ORM\JoinColumn(name="parent_option_id", referencedColumnName="iid")
49
     */
50
    protected ?CSurveyQuestionOption $parentOption = null;
51
52
    /**
53
     * @ORM\ManyToOne(targetEntity="CSurvey", inversedBy="questions")
54
     * @ORM\JoinColumn(name="survey_id", referencedColumnName="iid")
55
     */
56
    protected CSurvey $survey;
57
58
    /**
59
     * @ORM\Column(name="c_id", type="integer")
60
     */
61
    protected int $cId;
62
63
    /**
64
     * @Assert\NotBlank()
65
     *
66
     * @ORM\Column(name="survey_question", type="text", nullable=false)
67
     */
68
    protected string $surveyQuestion;
69
70
    /**
71
     * @ORM\Column(name="survey_question_comment", type="text", nullable=false)
72
     */
73
    protected ?string $surveyQuestionComment = null;
74
75
    /**
76
     * @ORM\Column(name="type", type="string", length=250, nullable=false)
77
     */
78
    protected string $type;
79
80
    /**
81
     * @ORM\Column(name="display", type="string", length=10, nullable=false)
82
     */
83
    protected string $display;
84
85
    /**
86
     * @ORM\Column(name="sort", type="integer", nullable=false)
87
     */
88
    protected int $sort;
89
90
    /**
91
     * @ORM\Column(name="shared_question_id", type="integer", nullable=true)
92
     */
93
    protected ?int $sharedQuestionId = null;
94
95
    /**
96
     * @ORM\Column(name="max_value", type="integer", nullable=true)
97
     */
98
    protected ?int $maxValue = null;
99
100
    /**
101
     * @ORM\Column(name="survey_group_pri", type="integer", nullable=false)
102
     */
103
    protected int $surveyGroupPri;
104
105
    /**
106
     * @ORM\Column(name="survey_group_sec1", type="integer", nullable=false)
107
     */
108
    protected int $surveyGroupSec1;
109
110
    /**
111
     * @ORM\Column(name="survey_group_sec2", type="integer", nullable=false)
112
     */
113
    protected int $surveyGroupSec2;
114
115
    /**
116
     * @ORM\Column(name="is_required", type="boolean", options={"default": false})
117
     */
118
    protected bool $isMandatory = false;
119
120
    /**
121
     * @var Collection|CSurveyAnswer[]
122
     *
123
     * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CSurveyAnswer", mappedBy="question")
124
     */
125
    protected Collection $answers;
126
127
    public function __construct()
128
    {
129
        $this->children = new ArrayCollection();
130
        $this->answers = new ArrayCollection();
131
        $this->surveyGroupPri = 0;
132
        $this->surveyGroupSec1 = 0;
133
        $this->surveyGroupSec2 = 0;
134
    }
135
136
    public function getIid(): int
137
    {
138
        return $this->iid;
139
    }
140
141
    /**
142
     * Set surveyQuestion.
143
     *
144
     * @return CSurveyQuestion
145
     */
146
    public function setSurveyQuestion(string $surveyQuestion)
147
    {
148
        $this->surveyQuestion = $surveyQuestion;
149
150
        return $this;
151
    }
152
153
    /**
154
     * Get surveyQuestion.
155
     *
156
     * @return string
157
     */
158
    public function getSurveyQuestion()
159
    {
160
        return $this->surveyQuestion;
161
    }
162
163
    /**
164
     * Set surveyQuestionComment.
165
     *
166
     * @return CSurveyQuestion
167
     */
168
    public function setSurveyQuestionComment(string $surveyQuestionComment)
169
    {
170
        $this->surveyQuestionComment = $surveyQuestionComment;
171
172
        return $this;
173
    }
174
175
    /**
176
     * Get surveyQuestionComment.
177
     *
178
     * @return string
179
     */
180
    public function getSurveyQuestionComment()
181
    {
182
        return $this->surveyQuestionComment;
183
    }
184
185
    /**
186
     * Set type.
187
     *
188
     * @return CSurveyQuestion
189
     */
190
    public function setType(string $type)
191
    {
192
        $this->type = $type;
193
194
        return $this;
195
    }
196
197
    /**
198
     * Get type.
199
     *
200
     * @return string
201
     */
202
    public function getType()
203
    {
204
        return $this->type;
205
    }
206
207
    /**
208
     * Set display.
209
     *
210
     * @return CSurveyQuestion
211
     */
212
    public function setDisplay(string $display)
213
    {
214
        $this->display = $display;
215
216
        return $this;
217
    }
218
219
    /**
220
     * Get display.
221
     *
222
     * @return string
223
     */
224
    public function getDisplay()
225
    {
226
        return $this->display;
227
    }
228
229
    /**
230
     * Set sort.
231
     *
232
     * @return CSurveyQuestion
233
     */
234
    public function setSort(int $sort)
235
    {
236
        $this->sort = $sort;
237
238
        return $this;
239
    }
240
241
    /**
242
     * Get sort.
243
     *
244
     * @return int
245
     */
246
    public function getSort()
247
    {
248
        return $this->sort;
249
    }
250
251
    public function setSharedQuestionId(int $sharedQuestionId): self
252
    {
253
        $this->sharedQuestionId = $sharedQuestionId;
254
255
        return $this;
256
    }
257
258
    /**
259
     * Get sharedQuestionId.
260
     *
261
     * @return int
262
     */
263
    public function getSharedQuestionId()
264
    {
265
        return $this->sharedQuestionId;
266
    }
267
268
    /**
269
     * Set maxValue.
270
     *
271
     * @return CSurveyQuestion
272
     */
273
    public function setMaxValue(int $maxValue)
274
    {
275
        $this->maxValue = $maxValue;
276
277
        return $this;
278
    }
279
280
    /**
281
     * Get maxValue.
282
     *
283
     * @return int
284
     */
285
    public function getMaxValue()
286
    {
287
        return $this->maxValue;
288
    }
289
290
    /**
291
     * Set surveyGroupPri.
292
     *
293
     * @return CSurveyQuestion
294
     */
295
    public function setSurveyGroupPri(int $surveyGroupPri)
296
    {
297
        $this->surveyGroupPri = $surveyGroupPri;
298
299
        return $this;
300
    }
301
302
    /**
303
     * Get surveyGroupPri.
304
     *
305
     * @return int
306
     */
307
    public function getSurveyGroupPri()
308
    {
309
        return $this->surveyGroupPri;
310
    }
311
312
    /**
313
     * Set surveyGroupSec1.
314
     *
315
     * @return CSurveyQuestion
316
     */
317
    public function setSurveyGroupSec1(int $surveyGroupSec1)
318
    {
319
        $this->surveyGroupSec1 = $surveyGroupSec1;
320
321
        return $this;
322
    }
323
324
    /**
325
     * Get surveyGroupSec1.
326
     *
327
     * @return int
328
     */
329
    public function getSurveyGroupSec1()
330
    {
331
        return $this->surveyGroupSec1;
332
    }
333
334
    /**
335
     * Set surveyGroupSec2.
336
     *
337
     * @return CSurveyQuestion
338
     */
339
    public function setSurveyGroupSec2(int $surveyGroupSec2)
340
    {
341
        $this->surveyGroupSec2 = $surveyGroupSec2;
342
343
        return $this;
344
    }
345
346
    /**
347
     * Get surveyGroupSec2.
348
     *
349
     * @return int
350
     */
351
    public function getSurveyGroupSec2()
352
    {
353
        return $this->surveyGroupSec2;
354
    }
355
356
    /**
357
     * Set cId.
358
     *
359
     * @return CSurveyQuestion
360
     */
361
    public function setCId(int $cId)
362
    {
363
        $this->cId = $cId;
364
365
        return $this;
366
    }
367
368
    /**
369
     * Get cId.
370
     *
371
     * @return int
372
     */
373
    public function getCId()
374
    {
375
        return $this->cId;
376
    }
377
378
    public function isMandatory(): bool
379
    {
380
        return $this->isMandatory;
381
    }
382
383
    public function setIsMandatory(bool $isMandatory): self
384
    {
385
        $this->isMandatory = $isMandatory;
386
387
        return $this;
388
    }
389
390
    public function getParent(): ?self
391
    {
392
        return $this->parent;
393
    }
394
395
    public function setParent(self $parent): self
396
    {
397
        $this->parent = $parent;
398
399
        return $this;
400
    }
401
402
    /**
403
     * @return Collection|CSurveyQuestion[]
404
     */
405
    public function getChildren()
406
    {
407
        return $this->children;
408
    }
409
410
    /**
411
     * @param ArrayCollection|CSurveyQuestion[] $children
412
     */
413
    public function setChildren($children): self
414
    {
415
        $this->children = $children;
416
417
        return $this;
418
    }
419
420
    public function getParentOption(): ?CSurveyQuestionOption
421
    {
422
        return $this->parentOption;
423
    }
424
425
    public function setParentOption(CSurveyQuestionOption $parentOption): self
426
    {
427
        $this->parentOption = $parentOption;
428
429
        return $this;
430
    }
431
432
    public function getSurvey(): CSurvey
433
    {
434
        return $this->survey;
435
    }
436
437
    public function setSurvey(CSurvey $survey): self
438
    {
439
        $this->survey = $survey;
440
441
        return $this;
442
    }
443
444
    /**
445
     * @return CSurveyAnswer[]|Collection
446
     */
447
    public function getAnswers()
448
    {
449
        return $this->answers;
450
    }
451
}
452