Passed
Push — master ( ea0e05...21d25a )
by Julito
08:49
created

CAttendance::getLogs()   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\CourseBundle\Entity;
8
9
use Chamilo\CoreBundle\Entity\AbstractResource;
10
use Chamilo\CoreBundle\Entity\ResourceInterface;
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
 * CAttendance.
18
 *
19
 * @ORM\Table(
20
 *     name="c_attendance",
21
 *     indexes={
22
 *         @ORM\Index(name="active", columns={"active"})
23
 *     }
24
 * )
25
 * @ORM\Entity
26
 */
27
class CAttendance extends AbstractResource implements ResourceInterface
28
{
29
    /**
30
     * @ORM\Column(name="iid", type="integer")
31
     * @ORM\Id
32
     * @ORM\GeneratedValue
33
     */
34
    protected int $iid;
35
36
    /**
37
     * @Assert\NotBlank
38
     * @ORM\Column(name="name", type="text", nullable=false)
39
     */
40
    protected string $name;
41
42
    /**
43
     * @ORM\Column(name="description", type="text", nullable=true)
44
     */
45
    protected ?string $description;
46
47
    /**
48
     * @ORM\Column(name="active", type="integer", nullable=false)
49
     */
50
    protected int $active;
51
52
    /**
53
     * @ORM\Column(name="attendance_qualify_title", type="string", length=255, nullable=true)
54
     */
55
    protected ?string $attendanceQualifyTitle = null;
56
57
    /**
58
     * @ORM\Column(name="attendance_qualify_max", type="integer", nullable=false)
59
     */
60
    protected int $attendanceQualifyMax;
61
62
    /**
63
     * @ORM\Column(name="attendance_weight", type="float", precision=6, scale=2, nullable=false)
64
     */
65
    protected float $attendanceWeight;
66
67
    /**
68
     * @ORM\Column(name="locked", type="integer", nullable=false)
69
     */
70
    protected int $locked;
71
72
    /**
73
     * @var Collection|CAttendanceCalendar[]
74
     *
75
     * @ORM\OneToMany(
76
     *     targetEntity="CAttendanceCalendar", mappedBy="attendance", cascade={"persist", "remove"}, orphanRemoval=true
77
     * )
78
     */
79
    protected Collection $calendars;
80
81
    /**
82
     * @var Collection|CAttendanceSheetLog[]
83
     *
84
     * @ORM\OneToMany(
85
     *     targetEntity="CAttendanceSheetLog", mappedBy="attendance", cascade={"persist", "remove"}, orphanRemoval=true
86
     * )
87
     */
88
    protected Collection $logs;
89
90
    public function __construct()
91
    {
92
        $this->description = '';
93
        $this->active = 1;
94
        $this->attendanceQualifyMax = 0;
95
        $this->locked = 0;
96
        $this->calendars = new ArrayCollection();
97
        $this->logs = new ArrayCollection();
98
    }
99
100
    public function __toString(): string
101
    {
102
        return (string) $this->getIid();
103
    }
104
105
    public function setName(string $name): self
106
    {
107
        $this->name = $name;
108
109
        return $this;
110
    }
111
112
    /**
113
     * Get name.
114
     *
115
     * @return string
116
     */
117
    public function getName()
118
    {
119
        return $this->name;
120
    }
121
122
    public function setDescription(string $description): self
123
    {
124
        $this->description = $description;
125
126
        return $this;
127
    }
128
129
    public function getDescription(): ?string
130
    {
131
        return $this->description;
132
    }
133
134
    public function setActive(int $active): self
135
    {
136
        $this->active = $active;
137
138
        return $this;
139
    }
140
141
    public function getActive(): int
142
    {
143
        return $this->active;
144
    }
145
146
    /**
147
     * Set attendanceQualifyTitle.
148
     *
149
     * @return CAttendance
150
     */
151
    public function setAttendanceQualifyTitle(string $attendanceQualifyTitle)
152
    {
153
        $this->attendanceQualifyTitle = $attendanceQualifyTitle;
154
155
        return $this;
156
    }
157
158
    /**
159
     * Get attendanceQualifyTitle.
160
     *
161
     * @return string
162
     */
163
    public function getAttendanceQualifyTitle()
164
    {
165
        return $this->attendanceQualifyTitle;
166
    }
167
168
    public function setAttendanceQualifyMax(int $attendanceQualifyMax): self
169
    {
170
        $this->attendanceQualifyMax = $attendanceQualifyMax;
171
172
        return $this;
173
    }
174
175
    /**
176
     * Get attendanceQualifyMax.
177
     *
178
     * @return int
179
     */
180
    public function getAttendanceQualifyMax()
181
    {
182
        return $this->attendanceQualifyMax;
183
    }
184
185
    public function setAttendanceWeight(float $attendanceWeight): self
186
    {
187
        $this->attendanceWeight = $attendanceWeight;
188
189
        return $this;
190
    }
191
192
    /**
193
     * Get attendanceWeight.
194
     *
195
     * @return float
196
     */
197
    public function getAttendanceWeight()
198
    {
199
        return $this->attendanceWeight;
200
    }
201
202
    public function setLocked(int $locked): self
203
    {
204
        $this->locked = $locked;
205
206
        return $this;
207
    }
208
209
    /**
210
     * Get locked.
211
     *
212
     * @return int
213
     */
214
    public function getLocked()
215
    {
216
        return $this->locked;
217
    }
218
219
    public function getIid(): int
220
    {
221
        return $this->iid;
222
    }
223
224
    public function getCalendars(): Collection
225
    {
226
        return $this->calendars;
227
    }
228
229
    public function setCalendars(Collection $calendars): self
230
    {
231
        $this->calendars = $calendars;
232
233
        return $this;
234
    }
235
236
    /**
237
     * @return CAttendanceSheetLog[]|Collection
238
     */
239
    public function getLogs()
240
    {
241
        return $this->logs;
242
    }
243
244
    /**
245
     * @param CAttendanceSheetLog[]|Collection $logs
246
     */
247
    public function setLogs(Collection $logs): self
248
    {
249
        $this->logs = $logs;
250
251
        return $this;
252
    }
253
254
    public function getResourceIdentifier(): int
255
    {
256
        return $this->getIid();
257
    }
258
259
    public function getResourceName(): string
260
    {
261
        return $this->getName();
262
    }
263
264
    public function setResourceName(string $name): self
265
    {
266
        return $this->setName($name);
267
    }
268
}
269