Passed
Push — master ( fdd164...f34f3b )
by Julito
09:13
created

CAnnouncementAttachment::setFilename()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
rs 10
c 1
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 Doctrine\ORM\Mapping as ORM;
10
11
/**
12
 * CAnnouncementAttachment.
13
 *
14
 * @ORM\Table(
15
 *  name="c_announcement_attachment",
16
 *  indexes={
17
 *      @ORM\Index(name="course", columns={"c_id"})
18
 *  }
19
 * )
20
 * @ORM\Entity
21
 */
22
class CAnnouncementAttachment extends AbstractResource implements ResourceInterface
23
{
24
    /**
25
     * @var int
26
     *
27
     * @ORM\Column(name="iid", type="integer")
28
     * @ORM\Id
29
     * @ORM\GeneratedValue
30
     */
31
    protected $iid;
32
33
    /**
34
     * @var int
35
     *
36
     * @ORM\Column(name="id", type="integer", nullable=true)
37
     */
38
    protected $id;
39
40
    /**
41
     * @var int
42
     *
43
     * @ORM\Column(name="c_id", type="integer")
44
     */
45
    protected $cId;
46
47
    /**
48
     * @var string
49
     *
50
     * @ORM\Column(name="path", type="string", length=255, nullable=false)
51
     */
52
    protected $path;
53
54
    /**
55
     * @var string
56
     *
57
     * @ORM\Column(name="comment", type="text", nullable=true)
58
     */
59
    protected $comment;
60
61
    /**
62
     * @var int
63
     *
64
     * @ORM\Column(name="size", type="integer", nullable=false)
65
     */
66
    protected $size;
67
68
    /**
69
     * @var CAnnouncement
70
     *
71
     * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CAnnouncement", cascade={"persist"})
72
     * @ORM\JoinColumn(name="announcement_id", referencedColumnName="iid", onDelete="CASCADE" )
73
     */
74
    protected $announcement;
75
76
    /**
77
     * @var string
78
     *
79
     * @ORM\Column(name="filename", type="string", length=255, nullable=false)
80
     */
81
    protected $filename;
82
83
    public function __toString(): string
84
    {
85
        return $this->getFilename();
86
    }
87
88
    /**
89
     * Set path.
90
     *
91
     * @param string $path
92
     *
93
     * @return CAnnouncementAttachment
94
     */
95
    public function setPath($path)
96
    {
97
        $this->path = $path;
98
99
        return $this;
100
    }
101
102
    /**
103
     * Get path.
104
     *
105
     * @return string
106
     */
107
    public function getPath()
108
    {
109
        return $this->path;
110
    }
111
112
    /**
113
     * Set comment.
114
     *
115
     * @param string $comment
116
     *
117
     * @return CAnnouncementAttachment
118
     */
119
    public function setComment($comment)
120
    {
121
        $this->comment = $comment;
122
123
        return $this;
124
    }
125
126
    /**
127
     * Get comment.
128
     *
129
     * @return string
130
     */
131
    public function getComment()
132
    {
133
        return $this->comment;
134
    }
135
136
    /**
137
     * Set size.
138
     *
139
     * @param int $size
140
     *
141
     * @return CAnnouncementAttachment
142
     */
143
    public function setSize($size)
144
    {
145
        $this->size = $size;
146
147
        return $this;
148
    }
149
150
    /**
151
     * Get size.
152
     *
153
     * @return int
154
     */
155
    public function getSize()
156
    {
157
        return $this->size;
158
    }
159
160
    public function getIid(): int
161
    {
162
        return $this->iid;
163
    }
164
165
    /**
166
     * Set filename.
167
     *
168
     * @param string $filename
169
     *
170
     * @return CAnnouncementAttachment
171
     */
172
    public function setFilename($filename)
173
    {
174
        $this->filename = $filename;
175
176
        return $this;
177
    }
178
179
    /**
180
     * Get filename.
181
     *
182
     * @return string
183
     */
184
    public function getFilename()
185
    {
186
        return $this->filename;
187
    }
188
189
    /**
190
     * Set id.
191
     *
192
     * @param int $id
193
     *
194
     * @return CAnnouncementAttachment
195
     */
196
    public function setId($id)
197
    {
198
        $this->id = $id;
199
200
        return $this;
201
    }
202
203
    /**
204
     * Get id.
205
     *
206
     * @return int
207
     */
208
    public function getId()
209
    {
210
        return $this->id;
211
    }
212
213
    /**
214
     * Set cId.
215
     *
216
     * @param int $cId
217
     *
218
     * @return CAnnouncementAttachment
219
     */
220
    public function setCId($cId)
221
    {
222
        $this->cId = $cId;
223
224
        return $this;
225
    }
226
227
    /**
228
     * Get cId.
229
     *
230
     * @return int
231
     */
232
    public function getCId()
233
    {
234
        return $this->cId;
235
    }
236
237
    public function getAnnouncement(): CAnnouncement
238
    {
239
        return $this->announcement;
240
    }
241
242
    public function setAnnouncement(CAnnouncement $announcement): self
243
    {
244
        $this->announcement = $announcement;
245
246
        return $this;
247
    }
248
249
    /**
250
     * Resource identifier.
251
     */
252
    public function getResourceIdentifier(): int
253
    {
254
        return $this->getId();
255
    }
256
257
    public function getResourceName(): string
258
    {
259
        return $this->getFilename();
260
    }
261
}
262