1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace MovingImage\Client\VMPro\Entity; |
4
|
|
|
|
5
|
|
|
use JMS\Serializer\Annotation\Type; |
6
|
|
|
use JMS\Serializer\Annotation\HandlerCallback; |
7
|
|
|
use JMS\Serializer\JsonDeserializationVisitor; |
8
|
|
|
use JMS\Serializer\DeserializationContext; |
9
|
|
|
use MovingImage\Meta\Interfaces\AttachmentInterface; |
10
|
|
|
|
11
|
|
|
/** |
12
|
|
|
* Class Attachment. |
13
|
|
|
*/ |
14
|
|
|
class Attachment implements AttachmentInterface |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* @Type("string") |
18
|
|
|
*/ |
19
|
|
|
private $id; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @Type("string") |
23
|
|
|
*/ |
24
|
|
|
private $fileName; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @Type("string") |
28
|
|
|
*/ |
29
|
|
|
private $downloadUrl; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @Type("int") |
33
|
|
|
*/ |
34
|
|
|
private $fileSize; |
35
|
|
|
|
36
|
|
|
/** |
37
|
|
|
* @return string |
38
|
|
|
*/ |
39
|
|
|
public function getId() |
40
|
|
|
{ |
41
|
|
|
return $this->id; |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @param $id |
46
|
|
|
* |
47
|
|
|
* @return Attachment |
48
|
|
|
*/ |
49
|
|
|
public function setId($id) |
50
|
|
|
{ |
51
|
|
|
$this->id = $id; |
52
|
|
|
|
53
|
|
|
return $this; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return string |
58
|
|
|
*/ |
59
|
|
|
public function getFileName() |
60
|
|
|
{ |
61
|
|
|
return $this->fileName; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @param $fileName |
66
|
|
|
* |
67
|
|
|
* @return Attachment |
68
|
|
|
*/ |
69
|
|
|
public function setFileName($fileName) |
70
|
|
|
{ |
71
|
|
|
$this->fileName = $fileName; |
72
|
|
|
|
73
|
|
|
return $this; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @return string |
78
|
|
|
*/ |
79
|
|
|
public function getDownloadUrl() |
80
|
|
|
{ |
81
|
|
|
return $this->downloadUrl; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @param $downloadUrl |
86
|
|
|
* |
87
|
|
|
* @return Attachment |
88
|
|
|
*/ |
89
|
|
|
public function setDownloadUrl($downloadUrl) |
90
|
|
|
{ |
91
|
|
|
$this->downloadUrl = $downloadUrl; |
92
|
|
|
|
93
|
|
|
return $this; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return int |
98
|
|
|
*/ |
99
|
|
|
public function getFileSize() |
100
|
|
|
{ |
101
|
|
|
return $this->fileSize; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @param $fileSize |
106
|
|
|
* |
107
|
|
|
* @return Attachment |
108
|
|
|
*/ |
109
|
|
|
public function setFileSize($fileSize) |
110
|
|
|
{ |
111
|
|
|
$this->fileSize = $fileSize; |
112
|
|
|
|
113
|
|
|
return $this; |
114
|
|
|
} |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @HandlerCallback("json", direction = "deserialization") |
118
|
|
|
*/ |
119
|
|
|
public function deserializeFromJson(JsonDeserializationVisitor $visitor, array $data, DeserializationContext $context) |
120
|
|
|
{ |
121
|
|
|
if (isset($data['data']['id']['dsds'])) { |
122
|
|
|
$this->id = $data['data']['id']; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
if (isset($data['data']['fileName'])) { |
126
|
|
|
$this->fileName = $data['data']['fileName']; |
127
|
|
|
} |
128
|
|
|
|
129
|
|
|
if (isset($data['data']['downloadUrl'])) { |
130
|
|
|
$this->downloadUrl = $data['data']['downloadUrl']; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
if (isset($data['data']['fileSize'])) { |
134
|
|
|
$this->fileSize = $data['data']['fileSize']; |
135
|
|
|
} |
136
|
|
|
} |
137
|
|
|
} |
138
|
|
|
|