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

CForumAttachment::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
 * 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="c_id", type="integer")
37
     */
38
    protected $cId;
39
40
    /**
41
     * @var string
42
     *
43
     * @ORM\Column(name="path", type="string", length=255, nullable=false)
44
     */
45
    protected $path;
46
47
    /**
48
     * @var string
49
     *
50
     * @ORM\Column(name="comment", type="text", nullable=true)
51
     */
52
    protected $comment;
53
54
    /**
55
     * @var int
56
     *
57
     * @ORM\Column(name="size", type="integer", nullable=false)
58
     */
59
    protected $size;
60
61
    /**
62
     * @var CForumPost
63
     *
64
     * @ORM\ManyToOne(targetEntity="Chamilo\CourseBundle\Entity\CForumPost", cascade={"persist"}, inversedBy="attachments")
65
     * @ORM\JoinColumn(name="post_id", referencedColumnName="iid", onDelete="CASCADE")
66
     */
67
    protected $post;
68
69
    /**
70
     * @var string
71
     *
72
     * @ORM\Column(name="filename", type="string", length=255, nullable=false)
73
     */
74
    protected $filename;
75
76
    public function __construct()
77
    {
78
    }
79
80
    public function __toString(): string
81
    {
82
        return (string) $this->getFilename();
83
    }
84
85
    /**
86
     * Get iid.
87
     *
88
     * @return int
89
     */
90
    public function getIid()
91
    {
92
        return $this->iid;
93
    }
94
95
    /**
96
     * Set path.
97
     *
98
     * @param string $path
99
     *
100
     * @return CForumAttachment
101
     */
102
    public function setPath($path)
103
    {
104
        $this->path = $path;
105
106
        return $this;
107
    }
108
109
    /**
110
     * Get path.
111
     *
112
     * @return string
113
     */
114
    public function getPath()
115
    {
116
        return $this->path;
117
    }
118
119
    /**
120
     * Set comment.
121
     *
122
     * @param string $comment
123
     *
124
     * @return CForumAttachment
125
     */
126
    public function setComment($comment)
127
    {
128
        $this->comment = $comment;
129
130
        return $this;
131
    }
132
133
    /**
134
     * Get comment.
135
     *
136
     * @return string
137
     */
138
    public function getComment()
139
    {
140
        return $this->comment;
141
    }
142
143
    /**
144
     * Set size.
145
     *
146
     * @param int $size
147
     *
148
     * @return CForumAttachment
149
     */
150
    public function setSize($size)
151
    {
152
        $this->size = $size;
153
154
        return $this;
155
    }
156
157
    /**
158
     * Get size.
159
     *
160
     * @return int
161
     */
162
    public function getSize()
163
    {
164
        return $this->size;
165
    }
166
167
    /**
168
     * Set filename.
169
     *
170
     * @param string $filename
171
     *
172
     * @return CForumAttachment
173
     */
174
    public function setFilename($filename)
175
    {
176
        $this->filename = $filename;
177
178
        return $this;
179
    }
180
181
    /**
182
     * Get filename.
183
     *
184
     * @return string
185
     */
186
    public function getFilename()
187
    {
188
        return $this->filename;
189
    }
190
191
    /**
192
     * Set cId.
193
     *
194
     * @param int $cId
195
     *
196
     * @return CForumAttachment
197
     */
198
    public function setCId($cId)
199
    {
200
        $this->cId = $cId;
201
202
        return $this;
203
    }
204
205
    /**
206
     * Get cId.
207
     *
208
     * @return int
209
     */
210
    public function getCId()
211
    {
212
        return $this->cId;
213
    }
214
215
    public function getPost(): CForumPost
216
    {
217
        return $this->post;
218
    }
219
220
    public function setPost(CForumPost $post)
221
    {
222
        $this->post = $post;
223
224
        return $this;
225
    }
226
227
    /**
228
     * Resource identifier.
229
     */
230
    public function getResourceIdentifier(): int
231
    {
232
        return $this->getIid();
233
    }
234
235
    public function getResourceName(): string
236
    {
237
        return $this->getFilename();
238
    }
239
240
    public function setResourceName(string $name): self
241
    {
242
        return $this->setFilename($name);
243
    }
244
}
245