Passed
Push — master ( b95980...a81919 )
by Julito
08:46
created

GradebookCategory::getCourse()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
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;
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;
69
70
    /**
71
     * @ORM\Column(name="weight", type="float", precision=10, scale=0, nullable=false)
72
     */
73
    protected float $weight;
74
75
    /**
76
     * @ORM\Column(name="visible", type="boolean", nullable=false)
77
     */
78
    protected bool $visible;
79
80
    /**
81
     * @ORM\Column(name="certif_min_score", type="integer", nullable=true)
82
     */
83
    protected ?int $certifMinScore;
84
85
    /**
86
     * @ORM\Column(name="document_id", type="integer", nullable=true)
87
     */
88
    protected ?int $documentId;
89
90
    /**
91
     * @ORM\Column(name="locked", type="integer", nullable=false)
92
     */
93
    protected ?int $locked;
94
95
    /**
96
     * @ORM\Column(name="default_lowest_eval_exclude", type="boolean", nullable=true)
97
     */
98
    protected ?bool $defaultLowestEvalExclude;
99
100
    /**
101
     * @ORM\Column(name="generate_certificates", type="boolean", nullable=false)
102
     */
103
    protected bool $generateCertificates;
104
105
    /**
106
     * @ORM\Column(name="grade_model_id", type="integer", nullable=true)
107
     */
108
    protected ?int $gradeModelId;
109
110
    /**
111
     * @ORM\Column(
112
     *     name="is_requirement",
113
     *     type="boolean",
114
     *     nullable=false,
115
     *     options={"default":0 }
116
     * )
117
     */
118
    protected bool $isRequirement;
119
120
    /**
121
     * @ORM\Column(name="depends", type="text", nullable=true)
122
     */
123
    protected ?string $depends;
124
125
    /**
126
     * @ORM\Column(name="minimum_to_validate", type="integer", nullable=true)
127
     */
128
    protected ?int $minimumToValidate;
129
130
    /**
131
     * @ORM\Column(name="gradebooks_to_validate_in_dependence", type="integer", nullable=true)
132
     */
133
    protected ?int $gradeBooksToValidateInDependence;
134
135
    /**
136
     * @var Collection|GradebookComment[]
137
     *
138
     * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookComment", mappedBy="gradebook")
139
     */
140
    protected $comments;
141
142
    public function __construct()
143
    {
144
        $this->description = '';
145
        $this->comments = new ArrayCollection();
146
        $this->locked = 0;
147
        $this->generateCertificates = false;
148
        $this->isRequirement = false;
149
    }
150
151
    /**
152
     * Get id.
153
     *
154
     * @return int
155
     */
156
    public function getId()
157
    {
158
        return $this->id;
159
    }
160
161
    /**
162
     * Set name.
163
     *
164
     * @param string $name
165
     *
166
     * @return GradebookCategory
167
     */
168
    public function setName($name)
169
    {
170
        $this->name = $name;
171
172
        return $this;
173
    }
174
175
    /**
176
     * Get name.
177
     *
178
     * @return string
179
     */
180
    public function getName()
181
    {
182
        return $this->name;
183
    }
184
185
    public function setDescription(?string $description): self
186
    {
187
        $this->description = $description;
188
189
        return $this;
190
    }
191
192
    public function getDescription(): ?string
193
    {
194
        return $this->description;
195
    }
196
197
    /**
198
     * Set weight.
199
     *
200
     * @param float $weight
201
     */
202
    public function setWeight($weight): self
203
    {
204
        $this->weight = (float) $weight;
205
206
        return $this;
207
    }
208
209
    /**
210
     * Get weight.
211
     *
212
     * @return float
213
     */
214
    public function getWeight()
215
    {
216
        return $this->weight;
217
    }
218
219
    /**
220
     * Set visible.
221
     *
222
     * @param bool $visible
223
     *
224
     * @return GradebookCategory
225
     */
226
    public function setVisible($visible)
227
    {
228
        $this->visible = $visible;
229
230
        return $this;
231
    }
232
233
    /**
234
     * Get visible.
235
     *
236
     * @return bool
237
     */
238
    public function getVisible()
239
    {
240
        return $this->visible;
241
    }
242
243
    /**
244
     * Set certifMinScore.
245
     *
246
     * @param int $certifMinScore
247
     *
248
     * @return GradebookCategory
249
     */
250
    public function setCertifMinScore($certifMinScore)
251
    {
252
        $this->certifMinScore = $certifMinScore;
253
254
        return $this;
255
    }
256
257
    /**
258
     * Get certifMinScore.
259
     *
260
     * @return int
261
     */
262
    public function getCertifMinScore()
263
    {
264
        return $this->certifMinScore;
265
    }
266
267
    /**
268
     * Set documentId.
269
     *
270
     * @param int $documentId
271
     *
272
     * @return GradebookCategory
273
     */
274
    public function setDocumentId($documentId)
275
    {
276
        $this->documentId = $documentId;
277
278
        return $this;
279
    }
280
281
    /**
282
     * Get documentId.
283
     *
284
     * @return int
285
     */
286
    public function getDocumentId()
287
    {
288
        return $this->documentId;
289
    }
290
291
    /**
292
     * Set locked.
293
     *
294
     * @param int $locked
295
     *
296
     * @return GradebookCategory
297
     */
298
    public function setLocked($locked)
299
    {
300
        $this->locked = $locked;
301
302
        return $this;
303
    }
304
305
    /**
306
     * Get locked.
307
     *
308
     * @return int
309
     */
310
    public function getLocked()
311
    {
312
        return $this->locked;
313
    }
314
315
    /**
316
     * Set defaultLowestEvalExclude.
317
     *
318
     * @param bool $defaultLowestEvalExclude
319
     *
320
     * @return GradebookCategory
321
     */
322
    public function setDefaultLowestEvalExclude($defaultLowestEvalExclude)
323
    {
324
        $this->defaultLowestEvalExclude = $defaultLowestEvalExclude;
325
326
        return $this;
327
    }
328
329
    /**
330
     * Get defaultLowestEvalExclude.
331
     *
332
     * @return bool
333
     */
334
    public function getDefaultLowestEvalExclude()
335
    {
336
        return $this->defaultLowestEvalExclude;
337
    }
338
339
    /**
340
     * Set generateCertificates.
341
     *
342
     * @param bool $generateCertificates
343
     *
344
     * @return GradebookCategory
345
     */
346
    public function setGenerateCertificates($generateCertificates)
347
    {
348
        $this->generateCertificates = $generateCertificates;
349
350
        return $this;
351
    }
352
353
    /**
354
     * Get generateCertificates.
355
     *
356
     * @return bool
357
     */
358
    public function getGenerateCertificates()
359
    {
360
        return $this->generateCertificates;
361
    }
362
363
    /**
364
     * Set gradeModelId.
365
     *
366
     * @param int $gradeModelId
367
     *
368
     * @return GradebookCategory
369
     */
370
    public function setGradeModelId($gradeModelId)
371
    {
372
        $this->gradeModelId = $gradeModelId;
373
374
        return $this;
375
    }
376
377
    /**
378
     * Get gradeModelId.
379
     *
380
     * @return int
381
     */
382
    public function getGradeModelId()
383
    {
384
        return $this->gradeModelId;
385
    }
386
387
    /**
388
     * Set isRequirement.
389
     *
390
     * @param bool $isRequirement
391
     *
392
     * @return GradebookCategory
393
     */
394
    public function setIsRequirement($isRequirement)
395
    {
396
        $this->isRequirement = $isRequirement;
397
398
        return $this;
399
    }
400
401
    public function getCourse(): Course
402
    {
403
        return $this->course;
404
    }
405
406
    public function setCourse(Course $course): self
407
    {
408
        $this->course = $course;
409
410
        return $this;
411
    }
412
413
    public function getParent(): ?self
414
    {
415
        return $this->parent;
416
    }
417
418
    public function setParent(?self $parent): self
419
    {
420
        $this->parent = $parent;
421
422
        return $this;
423
    }
424
425
    public function getSession(): ?Session
426
    {
427
        return $this->session;
428
    }
429
430
    public function setSession(?Session $session): self
431
    {
432
        $this->session = $session;
433
434
        return $this;
435
    }
436
437
    /**
438
     * Get isRequirement.
439
     *
440
     * @return bool
441
     */
442
    public function getIsRequirement()
443
    {
444
        return $this->isRequirement;
445
    }
446
447
    public function getGradeBooksToValidateInDependence(): int
448
    {
449
        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...
450
    }
451
452
    public function setGradeBooksToValidateInDependence(int $value): self
453
    {
454
        $this->gradeBooksToValidateInDependence = $value;
455
456
        return $this;
457
    }
458
459
    /**
460
     * @return GradebookComment[]|Collection
461
     */
462
    public function getComments()
463
    {
464
        return $this->comments;
465
    }
466
467
    /**
468
     * @param GradebookComment[]|Collection $comments
469
     */
470
    public function setComments($comments): self
471
    {
472
        $this->comments = $comments;
473
474
        return $this;
475
    }
476
}
477