Passed
Push — master ( 43f231...6078d3 )
by Julito
08:55
created

CCalendarEvent::getAttachments()   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
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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\Common\Collections\ArrayCollection;
11
use Doctrine\ORM\Mapping as ORM;
12
13
/**
14
 * CCalendarEvent.
15
 *
16
 * @ORM\Table(
17
 *  name="c_calendar_event",
18
 *  indexes={
19
 *      @ORM\Index(name="course", columns={"c_id"}),
20
 *      @ORM\Index(name="session_id", columns={"session_id"})
21
 *  }
22
 * )
23
 * @ORM\Entity
24
 */
25
class CCalendarEvent extends AbstractResource implements ResourceInterface
26
{
27
    /**
28
     * @var int
29
     *
30
     * @ORM\Column(name="iid", type="integer")
31
     * @ORM\Id
32
     * @ORM\GeneratedValue
33
     */
34
    protected $iid;
35
36
    /**
37
     * @var int
38
     *
39
     * @ORM\Column(name="id", type="integer", nullable=true)
40
     */
41
    protected $id;
42
43
    /**
44
     * @var int
45
     *
46
     * @ORM\Column(name="c_id", type="integer")
47
     */
48
    protected $cId;
49
50
    /**
51
     * @var string
52
     *
53
     * @ORM\Column(name="title", type="string", length=255, nullable=false)
54
     */
55
    protected $title;
56
57
    /**
58
     * @var string
59
     *
60
     * @ORM\Column(name="content", type="text", nullable=true)
61
     */
62
    protected $content;
63
64
    /**
65
     * @var \DateTime
66
     *
67
     * @ORM\Column(name="start_date", type="datetime", nullable=true)
68
     */
69
    protected $startDate;
70
71
    /**
72
     * @var \DateTime
73
     *
74
     * @ORM\Column(name="end_date", type="datetime", nullable=true)
75
     */
76
    protected $endDate;
77
78
    /**
79
     * @var int
80
     *
81
     * @ORM\Column(name="parent_event_id", type="integer", nullable=true)
82
     */
83
    protected $parentEventId;
84
85
    /**
86
     * @var int
87
     *
88
     * @ORM\Column(name="session_id", type="integer", nullable=false)
89
     */
90
    protected $sessionId;
91
92
    /**
93
     * @var int
94
     *
95
     * @ORM\Column(name="all_day", type="integer", nullable=false)
96
     */
97
    protected $allDay;
98
99
    /**
100
     * @var string
101
     *
102
     * @ORM\Column(name="comment", type="text", nullable=true)
103
     */
104
    protected $comment;
105
106
    /**
107
     * @var string
108
     *
109
     * @ORM\Column(name="color", type="string", length=100, nullable=true)
110
     */
111
    protected $color;
112
113
    /**
114
     * @var Room
115
     *
116
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Room")
117
     * @ORM\JoinColumn(name="room_id", referencedColumnName="id")
118
     */
119
    protected $room;
120
121
    /**
122
     * @var ArrayCollection|CCalendarEventAttachment[]
123
     *
124
     * @ORM\OneToMany(targetEntity="Chamilo\CourseBundle\Entity\CCalendarEventAttachment", mappedBy="event", cascade={"persist", "remove"}, orphanRemoval=true)
125
     */
126
    protected $attachments;
127
128
    public function __construct()
129
    {
130
    }
131
132
    public function __toString(): string
133
    {
134
        return $this->getTitle();
135
    }
136
137
    /**
138
     * Set title.
139
     *
140
     * @param string $title
141
     *
142
     * @return CCalendarEvent
143
     */
144
    public function setTitle($title)
145
    {
146
        $this->title = $title;
147
148
        return $this;
149
    }
150
151
    /**
152
     * Get title.
153
     *
154
     * @return string
155
     */
156
    public function getTitle()
157
    {
158
        return $this->title;
159
    }
160
161
    /**
162
     * Set content.
163
     *
164
     * @param string $content
165
     *
166
     * @return CCalendarEvent
167
     */
168
    public function setContent($content)
169
    {
170
        $this->content = $content;
171
172
        return $this;
173
    }
174
175
    /**
176
     * Get content.
177
     *
178
     * @return string
179
     */
180
    public function getContent()
181
    {
182
        return $this->content;
183
    }
184
185
    /**
186
     * Set startDate.
187
     *
188
     * @param \DateTime $startDate
189
     *
190
     * @return CCalendarEvent
191
     */
192
    public function setStartDate($startDate)
193
    {
194
        $this->startDate = $startDate;
195
196
        return $this;
197
    }
198
199
    /**
200
     * Get startDate.
201
     *
202
     * @return \DateTime
203
     */
204
    public function getStartDate()
205
    {
206
        return $this->startDate;
207
    }
208
209
    /**
210
     * Set endDate.
211
     *
212
     * @param \DateTime $endDate
213
     *
214
     * @return CCalendarEvent
215
     */
216
    public function setEndDate($endDate)
217
    {
218
        $this->endDate = $endDate;
219
220
        return $this;
221
    }
222
223
    /**
224
     * Get endDate.
225
     *
226
     * @return \DateTime
227
     */
228
    public function getEndDate()
229
    {
230
        return $this->endDate;
231
    }
232
233
    /**
234
     * Set parentEventId.
235
     *
236
     * @param int $parentEventId
237
     *
238
     * @return CCalendarEvent
239
     */
240
    public function setParentEventId($parentEventId)
241
    {
242
        $this->parentEventId = $parentEventId;
243
244
        return $this;
245
    }
246
247
    /**
248
     * Get parentEventId.
249
     *
250
     * @return int
251
     */
252
    public function getParentEventId()
253
    {
254
        return $this->parentEventId;
255
    }
256
257
    /**
258
     * Set sessionId.
259
     *
260
     * @param int $sessionId
261
     *
262
     * @return CCalendarEvent
263
     */
264
    public function setSessionId($sessionId)
265
    {
266
        $this->sessionId = $sessionId;
267
268
        return $this;
269
    }
270
271
    /**
272
     * Get sessionId.
273
     *
274
     * @return int
275
     */
276
    public function getSessionId()
277
    {
278
        return $this->sessionId;
279
    }
280
281
    /**
282
     * Set allDay.
283
     *
284
     * @param int $allDay
285
     *
286
     * @return CCalendarEvent
287
     */
288
    public function setAllDay($allDay)
289
    {
290
        $this->allDay = $allDay;
291
292
        return $this;
293
    }
294
295
    /**
296
     * Get allDay.
297
     *
298
     * @return int
299
     */
300
    public function getAllDay()
301
    {
302
        return (int) $this->allDay;
303
    }
304
305
    /**
306
     * Set id.
307
     *
308
     * @param int $id
309
     *
310
     * @return CCalendarEvent
311
     */
312
    public function setId($id)
313
    {
314
        $this->id = $id;
315
316
        return $this;
317
    }
318
319
    /**
320
     * Get id.
321
     *
322
     * @return int
323
     */
324
    public function getId()
325
    {
326
        return $this->id;
327
    }
328
329
    /**
330
     * Set cId.
331
     *
332
     * @param int $cId
333
     *
334
     * @return CCalendarEvent
335
     */
336
    public function setCId($cId)
337
    {
338
        $this->cId = $cId;
339
340
        return $this;
341
    }
342
343
    /**
344
     * Get cId.
345
     *
346
     * @return int
347
     */
348
    public function getCId()
349
    {
350
        return $this->cId;
351
    }
352
353
    /**
354
     * @return string
355
     */
356
    public function getComment()
357
    {
358
        return $this->comment;
359
    }
360
361
    /**
362
     * @param string $comment
363
     *
364
     * @return CCalendarEvent
365
     */
366
    public function setComment($comment)
367
    {
368
        $this->comment = $comment;
369
370
        return $this;
371
    }
372
373
    /**
374
     * @return Room
375
     */
376
    public function getRoom()
377
    {
378
        return $this->room;
379
    }
380
381
    /**
382
     * @param Room $room
383
     *
384
     * @return $this
385
     */
386
    public function setRoom($room)
387
    {
388
        $this->room = $room;
389
390
        return $this;
391
    }
392
393
    /**
394
     * @return string
395
     */
396
    public function getColor()
397
    {
398
        return $this->color;
399
    }
400
401
    /**
402
     * @param string $color
403
     *
404
     * @return $this
405
     */
406
    public function setColor($color)
407
    {
408
        $this->color = $color;
409
410
        return $this;
411
    }
412
413
    /**
414
     * @return int
415
     */
416
    public function getIid()
417
    {
418
        return $this->iid;
419
    }
420
421
    /**
422
     * @param int $iid
423
     *
424
     * @return CCalendarEvent
425
     */
426
    public function setIid($iid)
427
    {
428
        $this->iid = $iid;
429
430
        return $this;
431
    }
432
433
    /**
434
     * @return CCalendarEventAttachment[]|ArrayCollection
435
     */
436
    public function getAttachments()
437
    {
438
        return $this->attachments;
439
    }
440
441
    /**
442
     * @param CCalendarEventAttachment[]|ArrayCollection $attachments
443
     *
444
     * @return CCalendarEvent
445
     */
446
    public function setAttachments($attachments)
447
    {
448
        $this->attachments = $attachments;
449
450
        return $this;
451
    }
452
453
    public function addAttachment(CCalendarEventAttachment $attachment)
454
    {
455
        $this->attachments->add($attachment);
456
457
        return $this;
458
    }
459
460
    /**
461
     * Resource identifier.
462
     */
463
    public function getResourceIdentifier(): int
464
    {
465
        return $this->getIid();
466
    }
467
468
    public function getResourceName(): string
469
    {
470
        return $this->getTitle();
471
    }
472
}
473