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