1 | <?php |
||
15 | class Image implements \JsonSerializable, S3ObjectInterface |
||
16 | { |
||
17 | const ALLOWED_CONTENT_TYPES = ['image/jpeg', 'image/png']; |
||
18 | |||
19 | use Timestampable; |
||
20 | |||
21 | /** |
||
22 | * @var int |
||
23 | * |
||
24 | * @ORM\Id |
||
25 | * @ORM\GeneratedValue |
||
26 | * @ORM\Column(type="integer") |
||
27 | */ |
||
28 | private $id; |
||
29 | |||
30 | /** |
||
31 | * @var resource|string |
||
32 | * |
||
33 | * @Assert\NotBlank(groups={"Api"}) |
||
34 | */ |
||
35 | private $content; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | * |
||
40 | * @ORM\Column(type="string", length=190, nullable=true) |
||
41 | * @Assert\Choice(callback="getAllowedTypes", groups={"Api"}) |
||
42 | * @Assert\NotNull(groups={"Api"}) |
||
43 | */ |
||
44 | private $contentType; |
||
45 | |||
46 | /** |
||
47 | * @var string |
||
48 | * |
||
49 | * @ORM\Column(type="text", nullable=true) |
||
50 | */ |
||
51 | private $s3Key; |
||
52 | |||
53 | /** |
||
54 | * @var string |
||
55 | */ |
||
56 | private $oldS3Key; |
||
57 | |||
58 | /** |
||
59 | * @var string |
||
60 | * |
||
61 | * @ORM\Column(type="string", length=191, nullable=true) |
||
62 | */ |
||
63 | private $nameFile; |
||
64 | |||
65 | /** |
||
66 | * @var string |
||
67 | * |
||
68 | * @ORM\Column(type="text", nullable=true) |
||
69 | */ |
||
70 | private $url; |
||
71 | |||
72 | public function __construct($prefix = null) |
||
77 | |||
78 | /** |
||
79 | * @return int |
||
80 | */ |
||
81 | public function getId() |
||
85 | |||
86 | /** |
||
87 | * @return resource|string |
||
88 | */ |
||
89 | public function getContent() |
||
93 | |||
94 | /** |
||
95 | * @param resource|string $content |
||
96 | * |
||
97 | * @return $this |
||
98 | */ |
||
99 | public function setContent($content) |
||
105 | |||
106 | /** |
||
107 | * @return string |
||
108 | */ |
||
109 | public function getS3Key() |
||
113 | |||
114 | /** |
||
115 | * @param string $s3Key |
||
116 | * |
||
117 | * @return $this |
||
118 | */ |
||
119 | public function setS3Key($s3Key) |
||
128 | |||
129 | /** |
||
130 | * @return string |
||
131 | */ |
||
132 | public function getOldS3Key() |
||
136 | |||
137 | /** |
||
138 | * @param string $oldS3Key |
||
139 | * |
||
140 | * @return $this |
||
141 | */ |
||
142 | public function setOldS3Key($oldS3Key) |
||
148 | |||
149 | /** |
||
150 | * @return string |
||
151 | */ |
||
152 | public function getNameFile() |
||
156 | |||
157 | /** |
||
158 | * @param string $nameFile |
||
159 | * |
||
160 | * @return $this |
||
161 | */ |
||
162 | public function setNameFile($nameFile) |
||
168 | |||
169 | /** |
||
170 | * @return string |
||
171 | */ |
||
172 | public function getUrl() |
||
176 | |||
177 | /** |
||
178 | * @param string $url |
||
179 | * |
||
180 | * @return $this |
||
181 | */ |
||
182 | public function setUrl($url) |
||
188 | |||
189 | /** |
||
190 | * @return string |
||
191 | */ |
||
192 | public function getContentType() |
||
196 | |||
197 | /** |
||
198 | * @param string $contentType |
||
199 | * |
||
200 | * @return $this |
||
201 | */ |
||
202 | public function setContentType($contentType) |
||
208 | |||
209 | public static function getAllowedTypes() |
||
213 | |||
214 | public function jsonSerialize() |
||
218 | } |
||
219 |