Passed
Push — master ( de0fbe...d2acd0 )
by Julito
13:32
created

GradebookEvaluation::setCategory()   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
<?php
2
3
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CoreBundle\Entity;
6
7
use Chamilo\CoreBundle\Traits\CourseTrait;
8
use Chamilo\CoreBundle\Traits\UserTrait;
9
use Doctrine\ORM\Mapping as ORM;
10
use Gedmo\Mapping\Annotation as Gedmo;
11
12
/**
13
 * GradebookEvaluation.
14
 *
15
 * @ORM\Table(name="gradebook_evaluation",
16
 *  indexes={
17
 *     @ORM\Index(name="idx_ge_cat", columns={"category_id"}),
18
 *  })
19
 * @ORM\Entity
20
 */
21
class GradebookEvaluation
22
{
23
    use CourseTrait;
24
    use UserTrait;
25
26
    /**
27
     * @var int
28
     *
29
     * @ORM\Column(name="id", type="integer")
30
     * @ORM\Id
31
     * @ORM\GeneratedValue
32
     */
33
    protected $id;
34
35
    /**
36
     * @ORM\Column(name="name", type="text", nullable=false)
37
     */
38
    protected string $name;
39
40
    /**
41
     * @ORM\Column(name="description", type="text", nullable=true)
42
     */
43
    protected ?string $description;
44
45
    /**
46
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="gradeBookEvaluations")
47
     * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE")
48
     */
49
    protected User $user;
50
51
    /**
52
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Course", inversedBy="gradebookEvaluations")
53
     * @ORM\JoinColumn(name="c_id", referencedColumnName="id")
54
     */
55
    protected Course $course;
56
57
    /**
58
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\GradebookCategory")
59
     * @ORM\JoinColumn(name="category_id", referencedColumnName="id")
60
     */
61
    protected GradebookCategory $category;
62
63
    /**
64
     * @var \DateTime
65
     *
66
     * @Gedmo\Timestampable(on="create")
67
     * @ORM\Column(name="created_at", type="datetime", nullable=false)
68
     */
69
    protected $createdAt;
70
71
    /**
72
     * @var float
73
     *
74
     * @ORM\Column(name="weight", type="float", precision=10, scale=0, nullable=false)
75
     */
76
    protected $weight;
77
78
    /**
79
     * @var float
80
     *
81
     * @ORM\Column(name="max", type="float", precision=10, scale=0, nullable=false)
82
     */
83
    protected $max;
84
85
    /**
86
     * @var int
87
     *
88
     * @ORM\Column(name="visible", type="integer", nullable=false)
89
     */
90
    protected $visible;
91
92
    /**
93
     * @var string
94
     *
95
     * @ORM\Column(name="type", type="string", length=40, nullable=false)
96
     */
97
    protected $type;
98
99
    /**
100
     * @var int
101
     *
102
     * @ORM\Column(name="locked", type="integer", nullable=false)
103
     */
104
    protected $locked;
105
106
    /**
107
     * @var float
108
     *
109
     * @ORM\Column(name="best_score", type="float", precision=6, scale=2, nullable=true)
110
     */
111
    protected $bestScore;
112
113
    /**
114
     * @var float
115
     *
116
     * @ORM\Column(name="average_score", type="float", precision=6, scale=2, nullable=true)
117
     */
118
    protected $averageScore;
119
120
    /**
121
     * @var float
122
     *
123
     * @ORM\Column(name="score_weight", type="float", precision=6, scale=2, nullable=true)
124
     */
125
    protected $scoreWeight;
126
127
    /**
128
     * @var array
129
     *
130
     * @ORM\Column(name="user_score_list", type="array", nullable=true)
131
     */
132
    protected $userScoreList;
133
134
    public function __construct()
135
    {
136
        $this->locked = 0;
137
    }
138
139
    /**
140
     * Set name.
141
     *
142
     * @param string $name
143
     *
144
     * @return GradebookEvaluation
145
     */
146
    public function setName($name)
147
    {
148
        $this->name = $name;
149
150
        return $this;
151
    }
152
153
    /**
154
     * Get name.
155
     *
156
     * @return string
157
     */
158
    public function getName()
159
    {
160
        return $this->name;
161
    }
162
163
    /**
164
     * Set description.
165
     */
166
    public function setDescription(?string $description): self
167
    {
168
        $this->description = $description;
169
170
        return $this;
171
    }
172
173
    /**
174
     * Get description.
175
     *
176
     * @return string
177
     */
178
    public function getDescription()
179
    {
180
        return $this->description;
181
    }
182
183
    /**
184
     * Set createdAt.
185
     *
186
     * @param \DateTime $createdAt
187
     *
188
     * @return GradebookEvaluation
189
     */
190
    public function setCreatedAt($createdAt)
191
    {
192
        $this->createdAt = $createdAt;
193
194
        return $this;
195
    }
196
197
    /**
198
     * Get createdAt.
199
     *
200
     * @return \DateTime
201
     */
202
    public function getCreatedAt()
203
    {
204
        return $this->createdAt;
205
    }
206
207
    /**
208
     * Set weight.
209
     *
210
     * @param float $weight
211
     *
212
     * @return GradebookEvaluation
213
     */
214
    public function setWeight($weight)
215
    {
216
        $this->weight = $weight;
217
218
        return $this;
219
    }
220
221
    /**
222
     * Get weight.
223
     *
224
     * @return float
225
     */
226
    public function getWeight()
227
    {
228
        return $this->weight;
229
    }
230
231
    /**
232
     * Set max.
233
     *
234
     * @param float $max
235
     *
236
     * @return GradebookEvaluation
237
     */
238
    public function setMax($max)
239
    {
240
        $this->max = $max;
241
242
        return $this;
243
    }
244
245
    /**
246
     * Get max.
247
     *
248
     * @return float
249
     */
250
    public function getMax()
251
    {
252
        return $this->max;
253
    }
254
255
    /**
256
     * Set visible.
257
     *
258
     * @param int $visible
259
     *
260
     * @return GradebookEvaluation
261
     */
262
    public function setVisible($visible)
263
    {
264
        $this->visible = $visible;
265
266
        return $this;
267
    }
268
269
    /**
270
     * Get visible.
271
     *
272
     * @return int
273
     */
274
    public function getVisible()
275
    {
276
        return $this->visible;
277
    }
278
279
    /**
280
     * Set type.
281
     *
282
     * @param string $type
283
     *
284
     * @return GradebookEvaluation
285
     */
286
    public function setType($type)
287
    {
288
        $this->type = $type;
289
290
        return $this;
291
    }
292
293
    /**
294
     * Get type.
295
     *
296
     * @return string
297
     */
298
    public function getType()
299
    {
300
        return $this->type;
301
    }
302
303
    /**
304
     * Set locked.
305
     *
306
     * @param int $locked
307
     *
308
     * @return GradebookEvaluation
309
     */
310
    public function setLocked($locked)
311
    {
312
        $this->locked = $locked;
313
314
        return $this;
315
    }
316
317
    /**
318
     * Get locked.
319
     *
320
     * @return int
321
     */
322
    public function getLocked()
323
    {
324
        return $this->locked;
325
    }
326
327
    /**
328
     * Get id.
329
     *
330
     * @return int
331
     */
332
    public function getId()
333
    {
334
        return $this->id;
335
    }
336
337
    /**
338
     * @return float
339
     */
340
    public function getBestScore()
341
    {
342
        return $this->bestScore;
343
    }
344
345
    /**
346
     * @param float $bestScore
347
     *
348
     * @return GradebookEvaluation
349
     */
350
    public function setBestScore($bestScore)
351
    {
352
        $this->bestScore = $bestScore;
353
354
        return $this;
355
    }
356
357
    /**
358
     * @return float
359
     */
360
    public function getAverageScore()
361
    {
362
        return $this->averageScore;
363
    }
364
365
    /**
366
     * @param float $averageScore
367
     *
368
     * @return GradebookEvaluation
369
     */
370
    public function setAverageScore($averageScore)
371
    {
372
        $this->averageScore = $averageScore;
373
374
        return $this;
375
    }
376
377
    /**
378
     * @return array
379
     */
380
    public function getUserScoreList()
381
    {
382
        if (empty($this->userScoreList)) {
383
            return [];
384
        }
385
386
        return $this->userScoreList;
387
    }
388
389
    /**
390
     * @param array $userScoreList
391
     *
392
     * @return GradebookEvaluation
393
     */
394
    public function setUserScoreList($userScoreList)
395
    {
396
        $this->userScoreList = $userScoreList;
397
398
        return $this;
399
    }
400
401
    /**
402
     * @return float
403
     */
404
    public function getScoreWeight()
405
    {
406
        return $this->scoreWeight;
407
    }
408
409
    /**
410
     * @param float $scoreWeight
411
     *
412
     * @return GradebookEvaluation
413
     */
414
    public function setScoreWeight($scoreWeight)
415
    {
416
        $this->scoreWeight = $scoreWeight;
417
418
        return $this;
419
    }
420
421
    public function getCategory(): GradebookCategory
422
    {
423
        return $this->category;
424
    }
425
426
    public function setCategory(GradebookCategory $category): self
427
    {
428
        $this->category = $category;
429
430
        return $this;
431
    }
432
}
433