Completed
Push — master ( db9c88...be5baf )
by Julito
14:58
created

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