1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace MediaMonks\SonataMediaBundle\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
6
|
|
|
use MediaMonks\SonataMediaBundle\Model\MediaInterface; |
7
|
|
|
use MediaMonks\SonataMediaBundle\Model\MediaTrait; |
8
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
9
|
|
|
|
10
|
|
|
/** |
11
|
|
|
* @ORM\Entity(repositoryClass="MediaRepository") |
12
|
|
|
* @ORM\Table(name="media") |
13
|
|
|
*/ |
14
|
|
|
class Media implements MediaInterface |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @ORM\Column(name="id", type="integer") |
18
|
|
|
* @ORM\Id |
19
|
|
|
* @ORM\GeneratedValue(strategy="AUTO") |
20
|
|
|
*/ |
21
|
|
|
private $id; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @ORM\Column(type="string", nullable=true) |
25
|
|
|
*/ |
26
|
|
|
private $title; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @ORM\Column(type="text", nullable=true) |
30
|
|
|
*/ |
31
|
|
|
private $description; |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* @ORM\Column(type="string") |
35
|
|
|
*/ |
36
|
|
|
private $provider; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @ORM\Column(type="string") |
40
|
|
|
*/ |
41
|
|
|
private $type; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @ORM\Column(type="string") |
45
|
|
|
*/ |
46
|
|
|
private $providerReference; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @ORM\Column(type="json_array") |
50
|
|
|
*/ |
51
|
|
|
private $providerMetaData = []; |
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* @ORM\Column(type="string", nullable=true) |
55
|
|
|
*/ |
56
|
|
|
private $image; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @ORM\Column(type="json_array") |
60
|
|
|
*/ |
61
|
|
|
private $imageMetaData = []; |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @ORM\Column(type="string", nullable=true) |
65
|
|
|
*/ |
66
|
|
|
private $pointOfInterest; |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @ORM\Column(type="string", nullable=true) |
70
|
|
|
*/ |
71
|
|
|
private $copyright; |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @ORM\Column(type="string", nullable=true) |
75
|
|
|
*/ |
76
|
|
|
private $authorName; |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @var \DateTime |
80
|
|
|
* @ORM\Column(type="datetime") |
81
|
|
|
*/ |
82
|
|
|
private $createdAt; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @var \DateTime |
86
|
|
|
* @ORM\Column(type="datetime") |
87
|
|
|
*/ |
88
|
|
|
private $updatedAt; |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @var string |
92
|
|
|
*/ |
93
|
|
|
private $binaryContent; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @var string |
97
|
|
|
*/ |
98
|
|
|
private $imageContent; |
99
|
|
|
|
100
|
|
|
public function __construct() |
101
|
|
|
{ |
102
|
|
|
$this->createdAt = new \DateTime; |
103
|
|
|
$this->updatedAt = new \DateTime; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return mixed |
108
|
|
|
*/ |
109
|
|
|
public function getId() |
110
|
|
|
{ |
111
|
|
|
return $this->id; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @param mixed $id |
116
|
|
|
*/ |
117
|
|
|
public function setId($id) |
118
|
|
|
{ |
119
|
|
|
$this->id = $id; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @return mixed |
124
|
|
|
*/ |
125
|
|
|
public function getTitle() |
126
|
|
|
{ |
127
|
|
|
return $this->title; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @param mixed $title |
132
|
|
|
*/ |
133
|
|
|
public function setTitle($title) |
134
|
|
|
{ |
135
|
|
|
$this->title = $title; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @return mixed |
140
|
|
|
*/ |
141
|
|
|
public function getDescription() |
142
|
|
|
{ |
143
|
|
|
return $this->description; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @param mixed $description |
148
|
|
|
*/ |
149
|
|
|
public function setDescription($description) |
150
|
|
|
{ |
151
|
|
|
$this->description = $description; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @return mixed |
156
|
|
|
*/ |
157
|
|
|
public function getProvider() |
158
|
|
|
{ |
159
|
|
|
return $this->provider; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* @param mixed $provider |
164
|
|
|
* @return Media |
165
|
|
|
*/ |
166
|
|
|
public function setProvider($provider) |
167
|
|
|
{ |
168
|
|
|
$this->provider = $provider; |
169
|
|
|
|
170
|
|
|
return $this; |
171
|
|
|
} |
172
|
|
|
|
173
|
|
|
/** |
174
|
|
|
* @return mixed |
175
|
|
|
*/ |
176
|
|
|
public function getType() |
177
|
|
|
{ |
178
|
|
|
return $this->type; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
/** |
182
|
|
|
* @param mixed $type |
183
|
|
|
* @return Media |
184
|
|
|
*/ |
185
|
|
|
public function setType($type) |
186
|
|
|
{ |
187
|
|
|
$this->type = $type; |
188
|
|
|
|
189
|
|
|
return $this; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
/** |
193
|
|
|
* @return mixed |
194
|
|
|
*/ |
195
|
|
|
public function getProviderReference() |
196
|
|
|
{ |
197
|
|
|
return $this->providerReference; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
/** |
201
|
|
|
* @param mixed $providerReference |
202
|
|
|
*/ |
203
|
|
|
public function setProviderReference($providerReference) |
204
|
|
|
{ |
205
|
|
|
$this->providerReference = $providerReference; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* @return array |
210
|
|
|
*/ |
211
|
|
|
public function getProviderMetaData() |
212
|
|
|
{ |
213
|
|
|
return $this->providerMetaData; |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* @param array $providerMetaData |
218
|
|
|
*/ |
219
|
|
|
public function setProviderMetaData(array $providerMetaData) |
220
|
|
|
{ |
221
|
|
|
$this->providerMetaData = $providerMetaData; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
/** |
225
|
|
|
* @return mixed |
226
|
|
|
*/ |
227
|
|
|
public function getImage() |
228
|
|
|
{ |
229
|
|
|
return $this->image; |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
/** |
233
|
|
|
* @param mixed $image |
234
|
|
|
* @return Media |
235
|
|
|
*/ |
236
|
|
|
public function setImage($image) |
237
|
|
|
{ |
238
|
|
|
$this->image = $image; |
239
|
|
|
|
240
|
|
|
return $this; |
241
|
|
|
} |
242
|
|
|
|
243
|
|
|
/** |
244
|
|
|
* @return array |
245
|
|
|
*/ |
246
|
|
|
public function getImageMetaData() |
247
|
|
|
{ |
248
|
|
|
return $this->imageMetaData; |
249
|
|
|
} |
250
|
|
|
|
251
|
|
|
/** |
252
|
|
|
* @param array $imageMetaData |
253
|
|
|
* @return Media |
254
|
|
|
*/ |
255
|
|
|
public function setImageMetaData(array $imageMetaData) |
256
|
|
|
{ |
257
|
|
|
$this->imageMetaData = $imageMetaData; |
258
|
|
|
|
259
|
|
|
return $this; |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
/** |
263
|
|
|
* @return mixed |
264
|
|
|
*/ |
265
|
|
|
public function getPointOfInterest() |
266
|
|
|
{ |
267
|
|
|
return $this->pointOfInterest; |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* @param mixed $pointOfInterest |
272
|
|
|
* @return Media |
273
|
|
|
*/ |
274
|
|
|
public function setPointOfInterest($pointOfInterest) |
275
|
|
|
{ |
276
|
|
|
$this->pointOfInterest = $pointOfInterest; |
277
|
|
|
|
278
|
|
|
return $this; |
279
|
|
|
} |
280
|
|
|
|
281
|
|
|
/** |
282
|
|
|
* @return mixed |
283
|
|
|
*/ |
284
|
|
|
public function getCopyright() |
285
|
|
|
{ |
286
|
|
|
return $this->copyright; |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
/** |
290
|
|
|
* @param mixed $copyright |
291
|
|
|
*/ |
292
|
|
|
public function setCopyright($copyright) |
293
|
|
|
{ |
294
|
|
|
$this->copyright = $copyright; |
295
|
|
|
} |
296
|
|
|
|
297
|
|
|
/** |
298
|
|
|
* @return mixed |
299
|
|
|
*/ |
300
|
|
|
public function getAuthorName() |
301
|
|
|
{ |
302
|
|
|
return $this->authorName; |
303
|
|
|
} |
304
|
|
|
|
305
|
|
|
/** |
306
|
|
|
* @param mixed $authorName |
307
|
|
|
* @return Media |
308
|
|
|
*/ |
309
|
|
|
public function setAuthorName($authorName) |
310
|
|
|
{ |
311
|
|
|
$this->authorName = $authorName; |
312
|
|
|
|
313
|
|
|
return $this; |
314
|
|
|
} |
315
|
|
|
|
316
|
|
|
/** |
317
|
|
|
* @return string |
318
|
|
|
*/ |
319
|
|
|
public function getBinaryContent() |
320
|
|
|
{ |
321
|
|
|
return $this->binaryContent; |
322
|
|
|
} |
323
|
|
|
|
324
|
|
|
/** |
325
|
|
|
* @param string $binaryContent |
326
|
|
|
* @return Media |
327
|
|
|
*/ |
328
|
|
|
public function setBinaryContent($binaryContent) |
329
|
|
|
{ |
330
|
|
|
$this->binaryContent = $binaryContent; |
331
|
|
|
|
332
|
|
|
return $this; |
333
|
|
|
} |
334
|
|
|
|
335
|
|
|
/** |
336
|
|
|
* @return mixed |
337
|
|
|
*/ |
338
|
|
|
public function getSlug() |
339
|
|
|
{ |
340
|
|
|
return $this->getId(); |
341
|
|
|
} |
342
|
|
|
|
343
|
|
|
/** |
344
|
|
|
* @return mixed |
345
|
|
|
*/ |
346
|
|
|
public function getCreatedAt() |
347
|
|
|
{ |
348
|
|
|
return $this->createdAt; |
349
|
|
|
} |
350
|
|
|
|
351
|
|
|
/** |
352
|
|
|
* @param mixed $createdAt |
353
|
|
|
* @return Media |
354
|
|
|
*/ |
355
|
|
|
public function setCreatedAt($createdAt) |
356
|
|
|
{ |
357
|
|
|
$this->createdAt = $createdAt; |
358
|
|
|
|
359
|
|
|
return $this; |
360
|
|
|
} |
361
|
|
|
|
362
|
|
|
/** |
363
|
|
|
* @return \DateTime |
364
|
|
|
*/ |
365
|
|
|
public function getUpdatedAt() |
366
|
|
|
{ |
367
|
|
|
return $this->updatedAt; |
368
|
|
|
} |
369
|
|
|
|
370
|
|
|
/** |
371
|
|
|
* @param \DateTime $updatedAt |
372
|
|
|
* @return Media |
373
|
|
|
*/ |
374
|
|
|
public function setUpdatedAt($updatedAt) |
375
|
|
|
{ |
376
|
|
|
$this->updatedAt = $updatedAt; |
377
|
|
|
|
378
|
|
|
return $this; |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
/** |
382
|
|
|
* @return string |
383
|
|
|
*/ |
384
|
|
|
public function getImageContent() |
385
|
|
|
{ |
386
|
|
|
return $this->imageContent; |
387
|
|
|
} |
388
|
|
|
|
389
|
|
|
/** |
390
|
|
|
* @param string $imageContent |
391
|
|
|
* @return Media |
392
|
|
|
*/ |
393
|
|
|
public function setImageContent($imageContent) |
394
|
|
|
{ |
395
|
|
|
$this->imageContent = $imageContent; |
396
|
|
|
|
397
|
|
|
return $this; |
398
|
|
|
} |
399
|
|
|
} |
400
|
|
|
|