Passed
Push — master ( 1a7568...e6cbb8 )
by Julito
11:38
created

MessageAttachment::__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
declare(strict_types=1);
4
5
/* For licensing terms, see /license.txt */
6
7
namespace Chamilo\CoreBundle\Entity;
8
9
use Doctrine\ORM\Mapping as ORM;
10
11
/**
12
 * MessageAttachment.
13
 *
14
 * @ORM\Table(name="message_attachment")
15
 * @ORM\Entity
16
 */
17
class MessageAttachment extends AbstractResource implements ResourceInterface
18
{
19
    /**
20
     * @ORM\Column(name="id", type="integer")
21
     * @ORM\Id
22
     * @ORM\GeneratedValue(strategy="IDENTITY")
23
     */
24
    protected int $id;
25
26
    /**
27
     * @ORM\Column(name="path", type="string", length=255, nullable=false)
28
     */
29
    protected string $path;
30
31
    /**
32
     * @ORM\Column(name="comment", type="text", nullable=true)
33
     */
34
    protected ?string $comment = null;
35
36
    /**
37
     * @ORM\Column(name="size", type="integer", nullable=false)
38
     */
39
    protected int $size;
40
41
    /**
42
     * @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\Message", inversedBy="attachments")
43
     * @ORM\JoinColumn(name="message_id", referencedColumnName="id", nullable=false)
44
     */
45
    protected Message $message;
46
47
    /**
48
     * @ORM\Column(name="filename", type="string", length=255, nullable=false)
49
     */
50
    protected string $filename;
51
52
    public function __construct()
53
    {
54
        $this->size = 0;
55
        $this->comment = '';
56
        $this->path = '';
57
    }
58
59
    public function __toString(): string
60
    {
61
        return $this->getFilename();
62
    }
63
64
    public function setPath(string $path): self
65
    {
66
        $this->path = $path;
67
68
        return $this;
69
    }
70
71
    /**
72
     * Get path.
73
     *
74
     * @return string
75
     */
76
    public function getPath()
77
    {
78
        return $this->path;
79
    }
80
81
    public function setComment(string $comment): self
82
    {
83
        $this->comment = $comment;
84
85
        return $this;
86
    }
87
88
    /**
89
     * Get comment.
90
     *
91
     * @return string
92
     */
93
    public function getComment()
94
    {
95
        return $this->comment;
96
    }
97
98
    public function setSize(int $size): self
99
    {
100
        $this->size = $size;
101
102
        return $this;
103
    }
104
105
    public function getSize(): int
106
    {
107
        return $this->size;
108
    }
109
110
    public function setMessage(Message $message): self
111
    {
112
        $this->message = $message;
113
114
        return $this;
115
    }
116
117
    public function getMessage(): Message
118
    {
119
        return $this->message;
120
    }
121
122
    public function setFilename(string $filename): self
123
    {
124
        $this->filename = $filename;
125
126
        return $this;
127
    }
128
129
    public function getFilename(): string
130
    {
131
        return $this->filename;
132
    }
133
134
    /**
135
     * Get id.
136
     *
137
     * @return int
138
     */
139
    public function getId()
140
    {
141
        return $this->id;
142
    }
143
144
    public function getResourceIdentifier(): int
145
    {
146
        return $this->getId();
147
    }
148
149
    public function getResourceName(): string
150
    {
151
        return $this->getFilename();
152
    }
153
154
    public function setResourceName(string $name): self
155
    {
156
        return $this->setFilename($name);
157
    }
158
}
159