Passed
Push — master ( 4ca170...784f70 )
by Julito
12:58
created

CThematicAdvance::__toString()   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
/* For licensing terms, see /license.txt */
4
5
namespace Chamilo\CourseBundle\Entity;
6
7
use Chamilo\CoreBundle\Entity\Resource\AbstractResource;
8
use Chamilo\CoreBundle\Entity\Resource\ResourceInterface;
9
use Chamilo\CoreBundle\Entity\Room;
10
use Doctrine\ORM\Mapping as ORM;
11
12
/**
13
 * CThematicAdvance.
14
 *
15
 * @ORM\Table(
16
 *  name="c_thematic_advance",
17
 *  indexes={
18
 *      @ORM\Index(name="course", columns={"c_id"}),
19
 *      @ORM\Index(name="thematic_id", columns={"thematic_id"})
20
 *  }
21
 * )
22
 * @ORM\Entity
23
 */
24
class CThematicAdvance extends AbstractResource implements ResourceInterface
25
{
26
    /**
27
     * @var int
28
     *
29
     * @ORM\Column(name="iid", type="integer")
30
     * @ORM\Id
31
     * @ORM\GeneratedValue
32
     */
33
    protected $iid;
34
35
    /**
36
     * @var int
37
     *
38
     * @ORM\Column(name="c_id", type="integer")
39
     */
40
    protected $cId;
41
42
    /**
43
     * @var int
44
     *
45
     * @ORM\Column(name="id", type="integer", nullable=true)
46
     */
47
    protected $id;
48
49
    /**
50
     * @var CThematic
51
     *
52
     * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CThematic")
53
     * @ORM\JoinColumn(name="thematic_id", referencedColumnName="iid")
54
     */
55
    protected $thematic;
56
57
    /**
58
     * @var CAttendance
59
     *
60
     * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CAttendance")
61
     * @ORM\JoinColumn(name="attendance_id", referencedColumnName="iid")
62
     */
63
    protected $attendance;
64
65
    /**
66
     * @var string
67
     *
68
     * @ORM\Column(name="content", type="text", nullable=true)
69
     */
70
    protected $content;
71
72
    /**
73
     * @var \DateTime
74
     *
75
     * @ORM\Column(name="start_date", type="datetime", nullable=false)
76
     */
77
    protected $startDate;
78
79
    /**
80
     * @var int
81
     *
82
     * @ORM\Column(name="duration", type="integer", nullable=false)
83
     */
84
    protected $duration;
85
86
    /**
87
     * @var bool
88
     *
89
     * @ORM\Column(name="done_advance", type="boolean", nullable=false)
90
     */
91
    protected $doneAdvance;
92
93
    /**
94
     * @var Room
95
     *
96
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Room")
97
     * @ORM\JoinColumn(name="room_id", referencedColumnName="id")
98
     */
99
    protected $room;
100
101
    public function __construct()
102
    {
103
        $this->doneAdvance = 0;
0 ignored issues
show
Documentation Bug introduced by
The property $doneAdvance was declared of type boolean, but 0 is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
104
        $this->id = 0;
105
    }
106
107
    /**
108
     * Set content.
109
     *
110
     * @param string $content
111
     *
112
     * @return CThematicAdvance
113
     */
114
    public function setContent($content)
115
    {
116
        $this->content = $content;
117
118
        return $this;
119
    }
120
121
    /**
122
     * Get content.
123
     *
124
     * @return string
125
     */
126
    public function getContent()
127
    {
128
        return $this->content;
129
    }
130
131
    /**
132
     * Set startDate.
133
     *
134
     * @param \DateTime $startDate
135
     *
136
     * @return CThematicAdvance
137
     */
138
    public function setStartDate($startDate)
139
    {
140
        $this->startDate = $startDate;
141
142
        return $this;
143
    }
144
145
    /**
146
     * Get startDate.
147
     *
148
     * @return \DateTime
149
     */
150
    public function getStartDate()
151
    {
152
        return $this->startDate;
153
    }
154
155
    /**
156
     * Set duration.
157
     *
158
     * @param int $duration
159
     *
160
     * @return CThematicAdvance
161
     */
162
    public function setDuration($duration)
163
    {
164
        $this->duration = $duration;
165
166
        return $this;
167
    }
168
169
    /**
170
     * Get duration.
171
     *
172
     * @return int
173
     */
174
    public function getDuration()
175
    {
176
        return $this->duration;
177
    }
178
179
    /**
180
     * Set doneAdvance.
181
     *
182
     * @param bool $doneAdvance
183
     *
184
     * @return CThematicAdvance
185
     */
186
    public function setDoneAdvance($doneAdvance)
187
    {
188
        $this->doneAdvance = $doneAdvance;
189
190
        return $this;
191
    }
192
193
    /**
194
     * Get doneAdvance.
195
     *
196
     * @return bool
197
     */
198
    public function getDoneAdvance()
199
    {
200
        return $this->doneAdvance;
201
    }
202
203
    /**
204
     * Set id.
205
     *
206
     * @param int $id
207
     *
208
     * @return CThematicAdvance
209
     */
210
    public function setId($id)
211
    {
212
        $this->id = $id;
213
214
        return $this;
215
    }
216
217
    /**
218
     * Get id.
219
     *
220
     * @return int
221
     */
222
    public function getId()
223
    {
224
        return $this->id;
225
    }
226
227
    /**
228
     * Set cId.
229
     *
230
     * @param int $cId
231
     *
232
     * @return CThematicAdvance
233
     */
234
    public function setCId($cId)
235
    {
236
        $this->cId = $cId;
237
238
        return $this;
239
    }
240
241
    /**
242
     * Get cId.
243
     *
244
     * @return int
245
     */
246
    public function getCId()
247
    {
248
        return $this->cId;
249
    }
250
251
    /**
252
     * @return Room
253
     */
254
    public function getRoom()
255
    {
256
        return $this->room;
257
    }
258
259
    /**
260
     * @return $this
261
     */
262
    public function setRoom(Room $room)
263
    {
264
        $this->room = $room;
265
266
        return $this;
267
    }
268
269
    public function getThematic(): CThematic
270
    {
271
        return $this->thematic;
272
    }
273
274
    public function setThematic(CThematic $thematic): self
275
    {
276
        $this->thematic = $thematic;
277
278
        return $this;
279
    }
280
281
    public function getAttendance(): CAttendance
282
    {
283
        return $this->attendance;
284
    }
285
286
    public function setAttendance(CAttendance $attendance): self
287
    {
288
        $this->attendance = $attendance;
289
290
        return $this;
291
    }
292
293
    /**
294
     * @return int
295
     */
296
    public function getIid()
297
    {
298
        return $this->iid;
299
    }
300
301
    public function __toString(): string
302
    {
303
        return (string) $this->getIid();
304
    }
305
306
    /**
307
     * Resource identifier.
308
     */
309
    public function getResourceIdentifier(): int
310
    {
311
        return $this->getIid();
312
    }
313
314
    public function getResourceName(): string
315
    {
316
        return (string) $this->getContent();
317
    }
318
}
319