Passed
Push — master ( 50453a...1cb6b8 )
by Julito
09:01
created

CCalendarEventAttachment::getPath()   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\AbstractResource;
8
use Chamilo\CoreBundle\Entity\ResourceInterface;
9
use Doctrine\ORM\Mapping as ORM;
10
11
/**
12
 * CCalendarEventAttachment.
13
 *
14
 * @ORM\Table(
15
 *  name="c_calendar_event_attachment",
16
 *  indexes={
17
 *  }
18
 * )
19
 * @ORM\Entity
20
 */
21
class CCalendarEventAttachment extends AbstractResource implements ResourceInterface
22
{
23
    /**
24
     * @var int
25
     *
26
     * @ORM\Column(name="iid", type="integer")
27
     * @ORM\Id
28
     * @ORM\GeneratedValue
29
     */
30
    protected $iid;
31
32
    /**
33
     * @var string
34
     *
35
     * @ORM\Column(name="comment", type="text", nullable=true)
36
     */
37
    protected $comment;
38
39
    /**
40
     * @var string
41
     *
42
     * @ORM\Column(name="filename", type="string", length=255, nullable=false)
43
     */
44
    protected $filename;
45
46
    /**
47
     * @var CCalendarEvent
48
     *
49
     * @ORM\ManyToOne(targetEntity="CCalendarEvent", cascade={"persist"}, inversedBy="attachments")
50
     * @ORM\JoinColumn(name="agenda_id", referencedColumnName="iid", onDelete="CASCADE")
51
     */
52
    protected $event;
53
54
    public function __toString(): string
55
    {
56
        return $this->getFilename();
57
    }
58
59
    /**
60
     * Set comment.
61
     *
62
     * @param string $comment
63
     */
64
    public function setComment($comment): self
65
    {
66
        $this->comment = $comment;
67
68
        return $this;
69
    }
70
71
    /**
72
     * Get comment.
73
     *
74
     * @return string
75
     */
76
    public function getComment()
77
    {
78
        return $this->comment;
79
    }
80
81
    /**
82
     * Set filename.
83
     *
84
     * @param string $filename
85
     *
86
     * @return CCalendarEventAttachment
87
     */
88
    public function setFilename($filename)
89
    {
90
        $this->filename = $filename;
91
92
        return $this;
93
    }
94
95
    /**
96
     * Get filename.
97
     *
98
     * @return string
99
     */
100
    public function getFilename()
101
    {
102
        return $this->filename;
103
    }
104
105
    /**
106
     * @return int
107
     */
108
    public function getIid()
109
    {
110
        return $this->iid;
111
    }
112
113
    public function getEvent(): CCalendarEvent
114
    {
115
        return $this->event;
116
    }
117
118
    /**
119
     * @return CCalendarEventAttachment
120
     */
121
    public function setEvent(CCalendarEvent $event): self
122
    {
123
        $this->event = $event;
124
125
        return $this;
126
    }
127
128
    /**
129
     * Resource identifier.
130
     */
131
    public function getResourceIdentifier(): int
132
    {
133
        return $this->getIid();
134
    }
135
136
    public function getResourceName(): string
137
    {
138
        return $this->getFilename();
139
    }
140
141
    public function setResourceName(string $name): self
142
    {
143
        return $this->setFilename($name);
144
    }
145
}
146