Passed
Push — master ( ab8dec...906584 )
by Julito
09:36
created

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