|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Bukashk0zzzLiipImagineSerializationBundle |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Denis Golubovskiy <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Bukashk0zzz\LiipImagineSerializationBundle\Tests\Fixtures; |
|
13
|
|
|
|
|
14
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
15
|
|
|
use JMS\Serializer\Annotation as JMS; |
|
16
|
|
|
use Symfony\Component\HttpFoundation\File\File; |
|
17
|
|
|
use Vich\UploaderBundle\Mapping\Annotation as Vich; |
|
18
|
|
|
use Bukashk0zzz\LiipImagineSerializationBundle\Annotation as Bukashk0zzz; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* User Entity |
|
22
|
|
|
* |
|
23
|
|
|
* @ORM\Table(name="users") |
|
24
|
|
|
* @ORM\Entity() |
|
25
|
|
|
* |
|
26
|
|
|
* @JMS\ExclusionPolicy("all") |
|
27
|
|
|
* |
|
28
|
|
|
* @Vich\Uploadable |
|
29
|
|
|
* @Bukashk0zzz\LiipImagineSerializableClass |
|
30
|
|
|
*/ |
|
31
|
|
|
class User |
|
32
|
|
|
{ |
|
33
|
|
|
/** |
|
34
|
|
|
* @var string $coverUrl Cover url |
|
35
|
|
|
* |
|
36
|
|
|
* @ORM\Column(type="string", length=255) |
|
37
|
|
|
* |
|
38
|
|
|
* @JMS\Expose |
|
39
|
|
|
* @JMS\SerializedName("cover") |
|
40
|
|
|
* |
|
41
|
|
|
* @Bukashk0zzz\LiipImagineSerializableField("thumb_filter") |
|
42
|
|
|
*/ |
|
43
|
|
|
public $coverUrl; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @var string $imageUrl Image url |
|
47
|
|
|
* |
|
48
|
|
|
* @ORM\Column(type="string", length=255) |
|
49
|
|
|
* |
|
50
|
|
|
* @JMS\Expose |
|
51
|
|
|
* @JMS\SerializedName("image") |
|
52
|
|
|
* |
|
53
|
|
|
* @Bukashk0zzz\LiipImagineSerializableField(filter="thumb_filter", virtualField="imageThumb") |
|
54
|
|
|
*/ |
|
55
|
|
|
public $imageUrl; |
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @var string $photoName Photo name |
|
59
|
|
|
* |
|
60
|
|
|
* @ORM\Column(type="string", length=255) |
|
61
|
|
|
* |
|
62
|
|
|
* @JMS\Expose |
|
63
|
|
|
* @JMS\SerializedName("photo") |
|
64
|
|
|
* |
|
65
|
|
|
* @Bukashk0zzz\LiipImagineSerializableField(filter="thumb_filter", vichUploaderField="photoFile") |
|
66
|
|
|
*/ |
|
67
|
|
|
public $photoName; |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* @var File $photoFile Photo file |
|
71
|
|
|
* |
|
72
|
|
|
* @JMS\Exclude |
|
73
|
|
|
* |
|
74
|
|
|
* @Vich\UploadableField(mapping="user_photo_mapping", fileNameProperty="photoName") |
|
75
|
|
|
*/ |
|
76
|
|
|
public $photoFile; |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @ORM\OneToMany(targetEntity="Bukashk0zzz\LiipImagineSerializationBundle\Tests\Fixtures\UserPictures", mappedBy="user") |
|
80
|
|
|
*/ |
|
81
|
|
|
public $userPictures; |
|
82
|
|
|
|
|
83
|
|
|
/** |
|
84
|
|
|
* @ORM\OneToMany(targetEntity="Bukashk0zzz\LiipImagineSerializationBundle\Tests\Fixtures\UserPhotos", mappedBy="user") |
|
85
|
|
|
*/ |
|
86
|
|
|
public $userPhotos; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* User constructor. |
|
90
|
|
|
*/ |
|
91
|
|
|
public function __construct() |
|
92
|
|
|
{ |
|
93
|
|
|
$this->setCoverUrl(__DIR__.'/test.png'); |
|
94
|
|
|
$this->setPhotoName(__DIR__.'/test.png'); |
|
95
|
|
|
$this->setImageUrl(__DIR__.'/test.png'); |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* To string |
|
100
|
|
|
* |
|
101
|
|
|
* @return string |
|
102
|
|
|
*/ |
|
103
|
|
|
public function __toString() |
|
104
|
|
|
{ |
|
105
|
|
|
return 'New User'; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* Get photo name |
|
110
|
|
|
* |
|
111
|
|
|
* @return string Photo name |
|
112
|
|
|
*/ |
|
113
|
|
|
public function getPhotoName() |
|
114
|
|
|
{ |
|
115
|
|
|
return $this->photoName; |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
/** |
|
119
|
|
|
* Set photo name |
|
120
|
|
|
* |
|
121
|
|
|
* @param string $photoName Photo name |
|
122
|
|
|
* |
|
123
|
|
|
* @return $this |
|
124
|
|
|
*/ |
|
125
|
|
|
public function setPhotoName($photoName) |
|
126
|
|
|
{ |
|
127
|
|
|
$this->photoName = $photoName; |
|
128
|
|
|
|
|
129
|
|
|
return $this; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* Get photo file |
|
134
|
|
|
* |
|
135
|
|
|
* @return File Photo file |
|
136
|
|
|
*/ |
|
137
|
|
|
public function getPhotoFile() |
|
138
|
|
|
{ |
|
139
|
|
|
return $this->photoFile; |
|
140
|
|
|
} |
|
141
|
|
|
|
|
142
|
|
|
/** |
|
143
|
|
|
* Set photo file |
|
144
|
|
|
* |
|
145
|
|
|
* @param File $photoFile Photo file |
|
146
|
|
|
* |
|
147
|
|
|
* @return $this |
|
148
|
|
|
*/ |
|
149
|
|
|
public function setPhotoFile(File $photoFile) |
|
150
|
|
|
{ |
|
151
|
|
|
$this->photoFile = $photoFile; |
|
152
|
|
|
|
|
153
|
|
|
return $this; |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
/** |
|
157
|
|
|
* Add userPictures |
|
158
|
|
|
* |
|
159
|
|
|
* @param UserPictures $userPictures |
|
160
|
|
|
* |
|
161
|
|
|
* @return $this |
|
162
|
|
|
*/ |
|
163
|
|
|
public function addUserPictures(UserPictures $userPictures) |
|
164
|
|
|
{ |
|
165
|
|
|
$this->userPictures[] = $userPictures; |
|
166
|
|
|
|
|
167
|
|
|
return $this; |
|
168
|
|
|
} |
|
169
|
|
|
|
|
170
|
|
|
/** |
|
171
|
|
|
* Get userPictures |
|
172
|
|
|
* |
|
173
|
|
|
* @return \Doctrine\Common\Collections\Collection |
|
174
|
|
|
*/ |
|
175
|
|
|
public function getUserPictures() |
|
176
|
|
|
{ |
|
177
|
|
|
return $this->userPictures; |
|
178
|
|
|
} |
|
179
|
|
|
|
|
180
|
|
|
/** |
|
181
|
|
|
* Add userPhotos |
|
182
|
|
|
* |
|
183
|
|
|
* @param UserPhotos $userPhotos |
|
184
|
|
|
* |
|
185
|
|
|
* @return $this |
|
186
|
|
|
*/ |
|
187
|
|
|
public function addUserPhotos(UserPhotos $userPhotos) |
|
188
|
|
|
{ |
|
189
|
|
|
$this->userPhotos[] = $userPhotos; |
|
190
|
|
|
|
|
191
|
|
|
return $this; |
|
192
|
|
|
} |
|
193
|
|
|
|
|
194
|
|
|
/** |
|
195
|
|
|
* Get userPhotos |
|
196
|
|
|
* |
|
197
|
|
|
* @return \Doctrine\Common\Collections\Collection |
|
198
|
|
|
*/ |
|
199
|
|
|
public function getUserPhotos() |
|
200
|
|
|
{ |
|
201
|
|
|
return $this->userPhotos; |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
/** |
|
205
|
|
|
* @return string |
|
206
|
|
|
*/ |
|
207
|
|
|
public function getCoverUrl() |
|
208
|
|
|
{ |
|
209
|
|
|
return $this->coverUrl; |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
/** |
|
213
|
|
|
* @param string $coverUrl |
|
214
|
|
|
* @return $this |
|
215
|
|
|
*/ |
|
216
|
|
|
public function setCoverUrl($coverUrl) |
|
217
|
|
|
{ |
|
218
|
|
|
$this->coverUrl = $coverUrl; |
|
219
|
|
|
|
|
220
|
|
|
return $this; |
|
221
|
|
|
} |
|
222
|
|
|
|
|
223
|
|
|
/** |
|
224
|
|
|
* @return string |
|
225
|
|
|
*/ |
|
226
|
|
|
public function getImageUrl() |
|
227
|
|
|
{ |
|
228
|
|
|
return $this->imageUrl; |
|
229
|
|
|
} |
|
230
|
|
|
|
|
231
|
|
|
/** |
|
232
|
|
|
* @param string $imageUrl |
|
233
|
|
|
* @return $this |
|
234
|
|
|
*/ |
|
235
|
|
|
public function setImageUrl($imageUrl) |
|
236
|
|
|
{ |
|
237
|
|
|
$this->imageUrl = $imageUrl; |
|
238
|
|
|
|
|
239
|
|
|
return $this; |
|
240
|
|
|
} |
|
241
|
|
|
} |
|
242
|
|
|
|