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

GradebookCategory::getGradeModel()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
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
     * @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 = null;
84
85
    /**
86
     * @ORM\Column(name="document_id", type="integer", nullable=true)
87
     */
88
    protected ?int $documentId = null;
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 = null;
99
100
    /**
101
     * @ORM\Column(name="generate_certificates", type="boolean", nullable=false)
102
     */
103
    protected bool $generateCertificates;
104
105
    /**
106
     * @ORM\Column(
107
     *     name="is_requirement",
108
     *     type="boolean",
109
     *     nullable=false,
110
     *     options={"default":0 }
111
     * )
112
     */
113
    protected bool $isRequirement;
114
115
    /**
116
     * @ORM\Column(name="depends", type="text", nullable=true)
117
     */
118
    protected ?string $depends = null;
119
120
    /**
121
     * @ORM\Column(name="minimum_to_validate", type="integer", nullable=true)
122
     */
123
    protected ?int $minimumToValidate = null;
124
125
    /**
126
     * @ORM\Column(name="gradebooks_to_validate_in_dependence", type="integer", nullable=true)
127
     */
128
    protected ?int $gradeBooksToValidateInDependence = null;
129
130
    /**
131
     * @var Collection|GradebookComment[]
132
     *
133
     * @ORM\OneToMany(targetEntity="Chamilo\CoreBundle\Entity\GradebookComment", mappedBy="gradeBook")
134
     */
135
    protected Collection $comments;
136
137
    /**
138
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradeModel")
139
     * @ORM\JoinColumn(name="grade_model_id", referencedColumnName="id", onDelete="CASCADE")
140
     */
141
    protected ?GradeModel $gradeModel = null;
142
143
    public function __construct()
144
    {
145
        $this->description = '';
146
        $this->comments = new ArrayCollection();
147
        $this->locked = 0;
148
        $this->generateCertificates = false;
149
        $this->isRequirement = false;
150
    }
151
152
    /**
153
     * Get id.
154
     *
155
     * @return int
156
     */
157
    public function getId()
158
    {
159
        return $this->id;
160
    }
161
162
    public function setName(string $name): self
163
    {
164
        $this->name = $name;
165
166
        return $this;
167
    }
168
169
    /**
170
     * Get name.
171
     *
172
     * @return string
173
     */
174
    public function getName()
175
    {
176
        return $this->name;
177
    }
178
179
    public function setDescription(?string $description): self
180
    {
181
        $this->description = $description;
182
183
        return $this;
184
    }
185
186
    public function getDescription(): ?string
187
    {
188
        return $this->description;
189
    }
190
191
    public function setWeight(float $weight): self
192
    {
193
        $this->weight = $weight;
194
195
        return $this;
196
    }
197
198
    /**
199
     * Get weight.
200
     *
201
     * @return float
202
     */
203
    public function getWeight()
204
    {
205
        return $this->weight;
206
    }
207
208
    public function setVisible(bool $visible): self
209
    {
210
        $this->visible = $visible;
211
212
        return $this;
213
    }
214
215
    /**
216
     * Get visible.
217
     *
218
     * @return bool
219
     */
220
    public function getVisible()
221
    {
222
        return $this->visible;
223
    }
224
225
    public function setCertifMinScore(int $certifMinScore): self
226
    {
227
        $this->certifMinScore = $certifMinScore;
228
229
        return $this;
230
    }
231
232
    /**
233
     * Get certifMinScore.
234
     *
235
     * @return int
236
     */
237
    public function getCertifMinScore()
238
    {
239
        return $this->certifMinScore;
240
    }
241
242
    /**
243
     * Set documentId.
244
     *
245
     * @return GradebookCategory
246
     */
247
    public function setDocumentId(int $documentId)
248
    {
249
        $this->documentId = $documentId;
250
251
        return $this;
252
    }
253
254
    /**
255
     * Get documentId.
256
     *
257
     * @return int
258
     */
259
    public function getDocumentId()
260
    {
261
        return $this->documentId;
262
    }
263
264
    public function setLocked(int $locked): self
265
    {
266
        $this->locked = $locked;
267
268
        return $this;
269
    }
270
271
    /**
272
     * Get locked.
273
     *
274
     * @return int
275
     */
276
    public function getLocked()
277
    {
278
        return $this->locked;
279
    }
280
281
    public function setDefaultLowestEvalExclude(bool $defaultLowestEvalExclude): self
282
    {
283
        $this->defaultLowestEvalExclude = $defaultLowestEvalExclude;
284
285
        return $this;
286
    }
287
288
    /**
289
     * Get defaultLowestEvalExclude.
290
     *
291
     * @return bool
292
     */
293
    public function getDefaultLowestEvalExclude()
294
    {
295
        return $this->defaultLowestEvalExclude;
296
    }
297
298
    public function setGenerateCertificates(bool $generateCertificates): self
299
    {
300
        $this->generateCertificates = $generateCertificates;
301
302
        return $this;
303
    }
304
305
    /**
306
     * Get generateCertificates.
307
     *
308
     * @return bool
309
     */
310
    public function getGenerateCertificates()
311
    {
312
        return $this->generateCertificates;
313
    }
314
315
    public function setIsRequirement(bool $isRequirement): self
316
    {
317
        $this->isRequirement = $isRequirement;
318
319
        return $this;
320
    }
321
322
    public function getCourse(): Course
323
    {
324
        return $this->course;
325
    }
326
327
    public function setCourse(Course $course): self
328
    {
329
        $this->course = $course;
330
331
        return $this;
332
    }
333
334
    public function getParent(): ?self
335
    {
336
        return $this->parent;
337
    }
338
339
    public function setParent(?self $parent): self
340
    {
341
        $this->parent = $parent;
342
343
        return $this;
344
    }
345
346
    public function getSession(): ?Session
347
    {
348
        return $this->session;
349
    }
350
351
    public function setSession(?Session $session): self
352
    {
353
        $this->session = $session;
354
355
        return $this;
356
    }
357
358
    /**
359
     * Get isRequirement.
360
     *
361
     * @return bool
362
     */
363
    public function getIsRequirement()
364
    {
365
        return $this->isRequirement;
366
    }
367
368
    public function getGradeBooksToValidateInDependence(): int
369
    {
370
        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...
371
    }
372
373
    public function setGradeBooksToValidateInDependence(int $value): self
374
    {
375
        $this->gradeBooksToValidateInDependence = $value;
376
377
        return $this;
378
    }
379
380
    /**
381
     * @return GradebookComment[]|Collection
382
     */
383
    public function getComments()
384
    {
385
        return $this->comments;
386
    }
387
388
    /**
389
     * @param GradebookComment[]|Collection $comments
390
     */
391
    public function setComments(Collection $comments): self
392
    {
393
        $this->comments = $comments;
394
395
        return $this;
396
    }
397
398
    public function getGradeModel(): ?GradeModel
399
    {
400
        return $this->gradeModel;
401
    }
402
403
    public function setGradeModel(?GradeModel $gradeModel): self
404
    {
405
        $this->gradeModel = $gradeModel;
406
407
        return $this;
408
    }
409
}
410