Passed
Push — master ( 0c5975...84e769 )
by Julito
21:43
created

CAnnouncementAttachment::__toString()   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 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
    /**
161
     * @return int
162
     */
163
    public function getIid(): int
164
    {
165
        return $this->iid;
166
    }
167
168
    /**
169
     * @param int $iid
170
     *
171
     * @return CAnnouncementAttachment
172
     */
173
    public function setIid(int $iid): CAnnouncementAttachment
174
    {
175
        $this->iid = $iid;
176
177
        return $this;
178
    }
179
180
    /**
181
     * Set filename.
182
     *
183
     * @param string $filename
184
     *
185
     * @return CAnnouncementAttachment
186
     */
187
    public function setFilename($filename)
188
    {
189
        $this->filename = $filename;
190
191
        return $this;
192
    }
193
194
    /**
195
     * Get filename.
196
     *
197
     * @return string
198
     */
199
    public function getFilename()
200
    {
201
        return $this->filename;
202
    }
203
204
    /**
205
     * Set id.
206
     *
207
     * @param int $id
208
     *
209
     * @return CAnnouncementAttachment
210
     */
211
    public function setId($id)
212
    {
213
        $this->id = $id;
214
215
        return $this;
216
    }
217
218
    /**
219
     * Get id.
220
     *
221
     * @return int
222
     */
223
    public function getId()
224
    {
225
        return $this->id;
226
    }
227
228
    /**
229
     * Set cId.
230
     *
231
     * @param int $cId
232
     *
233
     * @return CAnnouncementAttachment
234
     */
235
    public function setCId($cId)
236
    {
237
        $this->cId = $cId;
238
239
        return $this;
240
    }
241
242
    /**
243
     * Get cId.
244
     *
245
     * @return int
246
     */
247
    public function getCId()
248
    {
249
        return $this->cId;
250
    }
251
252
    /**
253
     * @return CAnnouncement
254
     */
255
    public function getAnnouncement(): CAnnouncement
256
    {
257
        return $this->announcement;
258
    }
259
260
    /**
261
     * @param CAnnouncement $announcement
262
     *
263
     * @return CAnnouncementAttachment
264
     */
265
    public function setAnnouncement(CAnnouncement $announcement): CAnnouncementAttachment
266
    {
267
        $this->announcement = $announcement;
268
269
        return $this;
270
    }
271
272
    /**
273
     * Resource identifier.
274
     */
275
    public function getResourceIdentifier(): int
276
    {
277
        return $this->getId();
278
    }
279
280
    public function getResourceName(): string
281
    {
282
        return $this->getFilename();
283
    }
284
}
285