Passed
Push — master ( b5ff3f...de0fbe )
by Julito
09:48
created

GradebookLink   A

Complexity

Total Complexity 23

Size/Duplication

Total Lines 346
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 51
dl 0
loc 346
rs 10
c 0
b 0
f 0
wmc 23

22 Methods

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