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

CAnnouncementAttachment::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 Doctrine\ORM\Mapping as ORM;
10
11
/**
12
 * CAnnouncementAttachment.
13
 *
14
 * @ORM\Table(name="c_announcement_attachment")
15
 * @ORM\Entity
16
 */
17
class CAnnouncementAttachment extends AbstractResource implements ResourceInterface
18
{
19
    /**
20
     * @var int
21
     *
22
     * @ORM\Column(name="iid", type="integer")
23
     * @ORM\Id
24
     * @ORM\GeneratedValue
25
     */
26
    protected $iid;
27
28
    /**
29
     * @var string
30
     *
31
     * @ORM\Column(name="path", type="string", length=255, nullable=false)
32
     */
33
    protected $path;
34
35
    /**
36
     * @var string
37
     *
38
     * @ORM\Column(name="comment", type="text", nullable=true)
39
     */
40
    protected $comment;
41
42
    /**
43
     * @var int
44
     *
45
     * @ORM\Column(name="size", type="integer", nullable=false)
46
     */
47
    protected $size;
48
49
    /**
50
     * @var CAnnouncement
51
     *
52
     * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CAnnouncement", cascade={"persist"})
53
     * @ORM\JoinColumn(name="announcement_id", referencedColumnName="iid", onDelete="CASCADE" )
54
     */
55
    protected $announcement;
56
57
    /**
58
     * @var string
59
     *
60
     * @ORM\Column(name="filename", type="string", length=255, nullable=false)
61
     */
62
    protected $filename;
63
64
    public function __toString(): string
65
    {
66
        return $this->getFilename();
67
    }
68
69
    /**
70
     * Set path.
71
     *
72
     * @param string $path
73
     *
74
     * @return CAnnouncementAttachment
75
     */
76
    public function setPath($path)
77
    {
78
        $this->path = $path;
79
80
        return $this;
81
    }
82
83
    /**
84
     * Get path.
85
     *
86
     * @return string
87
     */
88
    public function getPath()
89
    {
90
        return $this->path;
91
    }
92
93
    /**
94
     * Set comment.
95
     *
96
     * @param string $comment
97
     *
98
     * @return CAnnouncementAttachment
99
     */
100
    public function setComment($comment)
101
    {
102
        $this->comment = $comment;
103
104
        return $this;
105
    }
106
107
    /**
108
     * Get comment.
109
     *
110
     * @return string
111
     */
112
    public function getComment()
113
    {
114
        return $this->comment;
115
    }
116
117
    /**
118
     * Set size.
119
     *
120
     * @param int $size
121
     *
122
     * @return CAnnouncementAttachment
123
     */
124
    public function setSize($size)
125
    {
126
        $this->size = $size;
127
128
        return $this;
129
    }
130
131
    /**
132
     * Get size.
133
     *
134
     * @return int
135
     */
136
    public function getSize()
137
    {
138
        return $this->size;
139
    }
140
141
    public function getIid(): int
142
    {
143
        return $this->iid;
144
    }
145
146
    /**
147
     * Set filename.
148
     *
149
     * @param string $filename
150
     *
151
     * @return CAnnouncementAttachment
152
     */
153
    public function setFilename($filename)
154
    {
155
        $this->filename = $filename;
156
157
        return $this;
158
    }
159
160
    /**
161
     * Get filename.
162
     *
163
     * @return string
164
     */
165
    public function getFilename()
166
    {
167
        return $this->filename;
168
    }
169
170
    public function getAnnouncement(): CAnnouncement
171
    {
172
        return $this->announcement;
173
    }
174
175
    public function setAnnouncement(CAnnouncement $announcement): self
176
    {
177
        $this->announcement = $announcement;
178
179
        return $this;
180
    }
181
182
    /**
183
     * Resource identifier.
184
     */
185
    public function getResourceIdentifier(): int
186
    {
187
        return $this->getIid();
188
    }
189
190
    public function getResourceName(): string
191
    {
192
        return $this->getFilename();
193
    }
194
195
    public function setResourceName(string $name): self
196
    {
197
        return $this->setFilename($name);
198
    }
199
}
200