1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* For licensing terms, see /license.txt */ |
6
|
|
|
|
7
|
|
|
namespace Chamilo\CourseBundle\Entity; |
8
|
|
|
|
9
|
|
|
use Chamilo\CoreBundle\Entity\AbstractResource; |
10
|
|
|
use Chamilo\CoreBundle\Entity\ResourceInterface; |
11
|
|
|
use Doctrine\ORM\Mapping as ORM; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* CAnnouncementAttachment. |
15
|
|
|
* |
16
|
|
|
* @ORM\Table(name="c_announcement_attachment") |
17
|
|
|
* @ORM\Entity(repositoryClass="Chamilo\CourseBundle\Repository\CAnnouncementAttachmentRepository") |
18
|
|
|
*/ |
19
|
|
|
class CAnnouncementAttachment extends AbstractResource implements ResourceInterface |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @ORM\Column(name="iid", type="integer") |
23
|
|
|
* @ORM\Id |
24
|
|
|
* @ORM\GeneratedValue |
25
|
|
|
*/ |
26
|
|
|
protected int $iid; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @ORM\Column(name="path", type="string", length=255, nullable=false) |
30
|
|
|
*/ |
31
|
|
|
protected string $path; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @ORM\Column(name="comment", type="text", nullable=true) |
35
|
|
|
*/ |
36
|
|
|
protected ?string $comment = null; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @ORM\Column(name="size", type="integer", nullable=false) |
40
|
|
|
*/ |
41
|
|
|
protected int $size; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @ORM\ManyToOne(targetEntity="CAnnouncement", inversedBy="attachments", cascade={"persist"}) |
45
|
|
|
* @ORM\JoinColumn(name="announcement_id", referencedColumnName="iid", onDelete="CASCADE") |
46
|
|
|
*/ |
47
|
|
|
protected CAnnouncement $announcement; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @ORM\Column(name="filename", type="string", length=255, nullable=false) |
51
|
|
|
*/ |
52
|
|
|
protected string $filename; |
53
|
|
|
|
54
|
|
|
public function __construct() |
55
|
|
|
{ |
56
|
|
|
$this->comment = ''; |
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
|
|
|
/** |
106
|
|
|
* Get size. |
107
|
|
|
* |
108
|
|
|
* @return int |
109
|
|
|
*/ |
110
|
|
|
public function getSize() |
111
|
|
|
{ |
112
|
|
|
return $this->size; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
public function getIid(): int |
116
|
|
|
{ |
117
|
|
|
return $this->iid; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
public function setFilename(string $filename): self |
121
|
|
|
{ |
122
|
|
|
$this->filename = $filename; |
123
|
|
|
|
124
|
|
|
return $this; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
/** |
128
|
|
|
* Get filename. |
129
|
|
|
* |
130
|
|
|
* @return string |
131
|
|
|
*/ |
132
|
|
|
public function getFilename() |
133
|
|
|
{ |
134
|
|
|
return $this->filename; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
public function getAnnouncement(): CAnnouncement |
138
|
|
|
{ |
139
|
|
|
return $this->announcement; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
public function setAnnouncement(CAnnouncement $announcement): self |
143
|
|
|
{ |
144
|
|
|
$this->announcement = $announcement; |
145
|
|
|
|
146
|
|
|
return $this; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
public function getResourceIdentifier(): int |
150
|
|
|
{ |
151
|
|
|
return $this->getIid(); |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
public function getResourceName(): string |
155
|
|
|
{ |
156
|
|
|
return $this->getFilename(); |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
public function setResourceName(string $name): self |
160
|
|
|
{ |
161
|
|
|
return $this->setFilename($name); |
162
|
|
|
} |
163
|
|
|
} |
164
|
|
|
|