Passed
Push — master ( 3398ac...23e37a )
by Julito
10:22
created

CForumAttachment::setPost()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 5
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\Resource\AbstractResource;
8
use Chamilo\CoreBundle\Entity\Resource\ResourceInterface;
9
use Doctrine\ORM\Mapping as ORM;
10
11
/**
12
 * CForumAttachment.
13
 *
14
 * @ORM\Table(
15
 *  name="c_forum_attachment",
16
 *  indexes={
17
 *      @ORM\Index(name="course", columns={"c_id"})
18
 *  }
19
 * )
20
 * @ORM\Entity
21
 */
22
class CForumAttachment 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 CForumPost
70
     *
71
     * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumPost", inversedBy="attachments")
72
     * @ORM\JoinColumn(name="post_id", referencedColumnName="iid")
73
     */
74
    protected $post;
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 __construct()
84
    {
85
    }
86
87
    public function __toString(): string
88
    {
89
        return (string) $this->getFilename();
90
    }
91
92
    /**
93
     * Get iid.
94
     *
95
     * @return int
96
     */
97
    public function getIid()
98
    {
99
        return $this->iid;
100
    }
101
102
    /**
103
     * Set path.
104
     *
105
     * @param string $path
106
     *
107
     * @return CForumAttachment
108
     */
109
    public function setPath($path)
110
    {
111
        $this->path = $path;
112
113
        return $this;
114
    }
115
116
    /**
117
     * Get path.
118
     *
119
     * @return string
120
     */
121
    public function getPath()
122
    {
123
        return $this->path;
124
    }
125
126
    /**
127
     * Set comment.
128
     *
129
     * @param string $comment
130
     *
131
     * @return CForumAttachment
132
     */
133
    public function setComment($comment)
134
    {
135
        $this->comment = $comment;
136
137
        return $this;
138
    }
139
140
    /**
141
     * Get comment.
142
     *
143
     * @return string
144
     */
145
    public function getComment()
146
    {
147
        return $this->comment;
148
    }
149
150
    /**
151
     * Set size.
152
     *
153
     * @param int $size
154
     *
155
     * @return CForumAttachment
156
     */
157
    public function setSize($size)
158
    {
159
        $this->size = $size;
160
161
        return $this;
162
    }
163
164
    /**
165
     * Get size.
166
     *
167
     * @return int
168
     */
169
    public function getSize()
170
    {
171
        return $this->size;
172
    }
173
174
    /**
175
     * Set filename.
176
     *
177
     * @param string $filename
178
     *
179
     * @return CForumAttachment
180
     */
181
    public function setFilename($filename)
182
    {
183
        $this->filename = $filename;
184
185
        return $this;
186
    }
187
188
    /**
189
     * Get filename.
190
     *
191
     * @return string
192
     */
193
    public function getFilename()
194
    {
195
        return $this->filename;
196
    }
197
198
    /**
199
     * Set id.
200
     *
201
     * @param int $id
202
     *
203
     * @return CForumAttachment
204
     */
205
    public function setId($id)
206
    {
207
        $this->id = $id;
208
209
        return $this;
210
    }
211
212
    /**
213
     * Get id.
214
     *
215
     * @return int
216
     */
217
    public function getId()
218
    {
219
        return $this->id;
220
    }
221
222
    /**
223
     * Set cId.
224
     *
225
     * @param int $cId
226
     *
227
     * @return CForumAttachment
228
     */
229
    public function setCId($cId)
230
    {
231
        $this->cId = $cId;
232
233
        return $this;
234
    }
235
236
    /**
237
     * Get cId.
238
     *
239
     * @return int
240
     */
241
    public function getCId()
242
    {
243
        return $this->cId;
244
    }
245
246
    public function getPost(): CForumPost
247
    {
248
        return $this->post;
249
    }
250
251
    public function setPost(CForumPost $post)
252
    {
253
        $this->post = $post;
254
255
        return $this;
256
    }
257
258
    /**
259
     * Resource identifier.
260
     */
261
    public function getResourceIdentifier(): int
262
    {
263
        return $this->getIid();
264
    }
265
266
    public function getResourceName(): string
267
    {
268
        return $this->getFilename();
269
    }
270
}
271