Passed
Push — master ( 4c4023...2b0e92 )
by Julito
07:08
created

CSurveyQuestion::setCId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0

1 Method

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