Passed
Push — master ( 8d1a37...25babe )
by Julito
22:45
created

GradebookCategory::setSession()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Entity;
8
9
use Chamilo\CoreBundle\Traits\CourseTrait;
10
use Chamilo\CoreBundle\Traits\UserTrait;
11
use Doctrine\Common\Collections\ArrayCollection;
12
use Doctrine\Common\Collections\Collection;
13
use Doctrine\ORM\Mapping as ORM;
14
use Symfony\Component\Validator\Constraints as Assert;
15
16
/**
17
 * @ORM\Table(name="gradebook_category",
18
 *     indexes={
19
 *     }))
20
 *     @ORM\Entity
21
 */
22
class GradebookCategory
23
{
24
    use UserTrait;
25
    use CourseTrait;
26
27
    /**
28
     * @ORM\Column(name="id", type="integer")
29
     * @ORM\Id
30
     * @ORM\GeneratedValue
31
     */
32
    protected int $id;
33
34
    /**
35
     * @Assert\NotBlank
36
     *
37
     * @ORM\Column(name="name", type="text", nullable=false)
38
     */
39
    protected string $name;
40
41
    /**
42
     * @ORM\Column(name="description", type="text", nullable=true)
43
     */
44
    protected ?string $description;
45
46
    /**
47
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="gradeBookCategories")
48
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id")
49
     */
50
    protected User $user;
51
52
    /**
53
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="gradebookCategories")
54
     * @ORM\JoinColumn(name="c_id", referencedColumnName="id", onDelete="CASCADE")
55
     */
56
    protected Course $course;
57
58
    /**
59
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory")
60
     * @ORM\JoinColumn(name="parent_id", referencedColumnName="id")
61
     */
62
    protected ?GradebookCategory $parent = null;
63
64
    /**
65
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Session")
66
     * @ORM\JoinColumn(name="session_id", referencedColumnName="id", onDelete="CASCADE")
67
     */
68
    protected ?Session $session = null;
69
70
    /**
71
     * @var Collection|GradebookEvaluation[]
72
     *
73
     * @ORM\OneToMany(targetEntity="GradebookEvaluation", mappedBy="category", cascade={"persist", "remove"})
74
     */
75
    protected Collection $evaluations;
76
77
    /**
78
     * @var Collection|GradebookLink[]
79
     *
80
     * @ORM\OneToMany(targetEntity="GradebookLink", mappedBy="category", cascade={"persist", "remove"})
81
     */
82
    protected Collection $links;
83
84
    /**
85
     * @ORM\Column(name="weight", type="float", precision=10, scale=0, nullable=false)
86
     */
87
    protected float $weight;
88
89
    /**
90
     * @ORM\Column(name="visible", type="boolean", nullable=false)
91
     */
92
    protected bool $visible;
93
94
    /**
95
     * @ORM\Column(name="certif_min_score", type="integer", nullable=true)
96
     */
97
    protected ?int $certifMinScore = null;
98
99
    /**
100
     * @ORM\Column(name="document_id", type="integer", nullable=true)
101
     */
102
    protected ?int $documentId = null;
103
104
    /**
105
     * @ORM\Column(name="locked", type="integer", nullable=false)
106
     */
107
    protected ?int $locked;
108
109
    /**
110
     * @ORM\Column(name="default_lowest_eval_exclude", type="boolean", nullable=true)
111
     */
112
    protected ?bool $defaultLowestEvalExclude = null;
113
114
    /**
115
     * @ORM\Column(name="generate_certificates", type="boolean", nullable=false)
116
     */
117
    protected bool $generateCertificates;
118
119
    /**
120
     * @ORM\Column(
121
     *     name="is_requirement",
122
     *     type="boolean",
123
     *     nullable=false,
124
     *     options={"default":0 }
125
     * )
126
     */
127
    protected bool $isRequirement;
128
129
    /**
130
     * @ORM\Column(name="depends", type="text", nullable=true)
131
     */
132
    protected ?string $depends = null;
133
134
    /**
135
     * @ORM\Column(name="minimum_to_validate", type="integer", nullable=true)
136
     */
137
    protected ?int $minimumToValidate = null;
138
139
    /**
140
     * @ORM\Column(name="gradebooks_to_validate_in_dependence", type="integer", nullable=true)
141
     */
142
    protected ?int $gradeBooksToValidateInDependence = null;
143
144
    /**
145
     * @var Collection|GradebookComment[]
146
     *
147
     * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookComment", mappedBy="gradeBook")
148
     */
149
    protected Collection $comments;
150
151
    /**
152
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradeModel")
153
     * @ORM\JoinColumn(name="grade_model_id", referencedColumnName="id", onDelete="CASCADE")
154
     */
155
    protected ?GradeModel $gradeModel = null;
156
157
    public function __construct()
158
    {
159
        $this->description = '';
160
        $this->comments = new ArrayCollection();
161
        $this->evaluations = new ArrayCollection();
162
        $this->links = new ArrayCollection();
163
        $this->locked = 0;
164
        $this->generateCertificates = false;
165
        $this->isRequirement = false;
166
    }
167
168
    /**
169
     * Get id.
170
     *
171
     * @return int
172
     */
173
    public function getId()
174
    {
175
        return $this->id;
176
    }
177
178
    public function setName(string $name): self
179
    {
180
        $this->name = $name;
181
182
        return $this;
183
    }
184
185
    /**
186
     * Get name.
187
     *
188
     * @return string
189
     */
190
    public function getName()
191
    {
192
        return $this->name;
193
    }
194
195
    public function setDescription(?string $description): self
196
    {
197
        $this->description = $description;
198
199
        return $this;
200
    }
201
202
    public function getDescription(): ?string
203
    {
204
        return $this->description;
205
    }
206
207
    public function setWeight(float $weight): self
208
    {
209
        $this->weight = $weight;
210
211
        return $this;
212
    }
213
214
    /**
215
     * Get weight.
216
     *
217
     * @return float
218
     */
219
    public function getWeight()
220
    {
221
        return $this->weight;
222
    }
223
224
    public function setVisible(bool $visible): self
225
    {
226
        $this->visible = $visible;
227
228
        return $this;
229
    }
230
231
    /**
232
     * Get visible.
233
     *
234
     * @return bool
235
     */
236
    public function getVisible()
237
    {
238
        return $this->visible;
239
    }
240
241
    public function setCertifMinScore(int $certifMinScore): self
242
    {
243
        $this->certifMinScore = $certifMinScore;
244
245
        return $this;
246
    }
247
248
    /**
249
     * Get certifMinScore.
250
     *
251
     * @return int
252
     */
253
    public function getCertifMinScore()
254
    {
255
        return $this->certifMinScore;
256
    }
257
258
    /**
259
     * Set documentId.
260
     *
261
     * @return GradebookCategory
262
     */
263
    public function setDocumentId(int $documentId)
264
    {
265
        $this->documentId = $documentId;
266
267
        return $this;
268
    }
269
270
    /**
271
     * Get documentId.
272
     *
273
     * @return int
274
     */
275
    public function getDocumentId()
276
    {
277
        return $this->documentId;
278
    }
279
280
    public function setLocked(int $locked): self
281
    {
282
        $this->locked = $locked;
283
284
        return $this;
285
    }
286
287
    /**
288
     * Get locked.
289
     *
290
     * @return int
291
     */
292
    public function getLocked()
293
    {
294
        return $this->locked;
295
    }
296
297
    public function setDefaultLowestEvalExclude(bool $defaultLowestEvalExclude): self
298
    {
299
        $this->defaultLowestEvalExclude = $defaultLowestEvalExclude;
300
301
        return $this;
302
    }
303
304
    /**
305
     * Get defaultLowestEvalExclude.
306
     *
307
     * @return bool
308
     */
309
    public function getDefaultLowestEvalExclude()
310
    {
311
        return $this->defaultLowestEvalExclude;
312
    }
313
314
    public function setGenerateCertificates(bool $generateCertificates): self
315
    {
316
        $this->generateCertificates = $generateCertificates;
317
318
        return $this;
319
    }
320
321
    /**
322
     * Get generateCertificates.
323
     *
324
     * @return bool
325
     */
326
    public function getGenerateCertificates()
327
    {
328
        return $this->generateCertificates;
329
    }
330
331
    public function setIsRequirement(bool $isRequirement): self
332
    {
333
        $this->isRequirement = $isRequirement;
334
335
        return $this;
336
    }
337
338
    public function getCourse(): Course
339
    {
340
        return $this->course;
341
    }
342
343
    public function setCourse(Course $course): self
344
    {
345
        $this->course = $course;
346
347
        return $this;
348
    }
349
350
    public function getParent(): ?self
351
    {
352
        return $this->parent;
353
    }
354
355
    public function setParent(?self $parent): self
356
    {
357
        $this->parent = $parent;
358
359
        return $this;
360
    }
361
362
    public function getSession(): ?Session
363
    {
364
        return $this->session;
365
    }
366
367
    public function setSession(?Session $session): self
368
    {
369
        $this->session = $session;
370
371
        return $this;
372
    }
373
374
    /**
375
     * Get isRequirement.
376
     *
377
     * @return bool
378
     */
379
    public function getIsRequirement()
380
    {
381
        return $this->isRequirement;
382
    }
383
384
    public function getGradeBooksToValidateInDependence(): int
385
    {
386
        return $this->gradeBooksToValidateInDependence;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->gradeBooksToValidateInDependence could return the type null which is incompatible with the type-hinted return integer. Consider adding an additional type-check to rule them out.
Loading history...
387
    }
388
389
    public function setGradeBooksToValidateInDependence(int $value): self
390
    {
391
        $this->gradeBooksToValidateInDependence = $value;
392
393
        return $this;
394
    }
395
396
    /**
397
     * @return GradebookComment[]|Collection
398
     */
399
    public function getComments()
400
    {
401
        return $this->comments;
402
    }
403
404
    /**
405
     * @param GradebookComment[]|Collection $comments
406
     */
407
    public function setComments(Collection $comments): self
408
    {
409
        $this->comments = $comments;
410
411
        return $this;
412
    }
413
414
    public function getGradeModel(): ?GradeModel
415
    {
416
        return $this->gradeModel;
417
    }
418
419
    public function setGradeModel(?GradeModel $gradeModel): self
420
    {
421
        $this->gradeModel = $gradeModel;
422
423
        return $this;
424
    }
425
426
    public function getUser(): User
427
    {
428
        return $this->user;
429
    }
430
431
    public function setUser(User $user): self
432
    {
433
        $this->user = $user;
434
435
        return $this;
436
    }
437
438
    /**
439
     * @return GradebookEvaluation[]|Collection
440
     */
441
    public function getEvaluations()
442
    {
443
        return $this->evaluations;
444
    }
445
446
    /**
447
     * @param GradebookEvaluation[]|Collection $evaluations
448
     */
449
    public function setEvaluations(Collection $evaluations)
450
    {
451
        $this->evaluations = $evaluations;
452
453
        return $this;
454
    }
455
456
    /**
457
     * @return GradebookLink[]|Collection
458
     */
459
    public function getLinks()
460
    {
461
        return $this->links;
462
    }
463
464
    /**
465
     * @param GradebookLink[]|Collection $links
466
     */
467
    public function setLinks(Collection $links): self
468
    {
469
        $this->links = $links;
470
471
        return $this;
472
    }
473
474
    public function getDepends(): ?string
475
    {
476
        return $this->depends;
477
    }
478
479
    public function setDepends(?string $depends): self
480
    {
481
        $this->depends = $depends;
482
483
        return $this;
484
    }
485
486
    public function getMinimumToValidate(): ?int
487
    {
488
        return $this->minimumToValidate;
489
    }
490
491
    public function setMinimumToValidate(?int $minimumToValidate): self
492
    {
493
        $this->minimumToValidate = $minimumToValidate;
494
495
        return $this;
496
    }
497
}
498