1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of Sulu. |
5
|
|
|
* |
6
|
|
|
* (c) MASSIVE ART WebServices GmbH |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the MIT license that is bundled |
9
|
|
|
* with this source code in the file LICENSE. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace Sulu\Bundle\ContactBundle\Api; |
13
|
|
|
|
14
|
|
|
use JMS\Serializer\Annotation\Groups; |
15
|
|
|
use JMS\Serializer\Annotation\SerializedName; |
16
|
|
|
use JMS\Serializer\Annotation\VirtualProperty; |
17
|
|
|
use Sulu\Bundle\ContactBundle\Entity\Address as AddressEntity; |
18
|
|
|
use Sulu\Bundle\ContactBundle\Entity\AddressType as AddressTypeEntity; |
19
|
|
|
use Sulu\Bundle\ContactBundle\Entity\Country as CountryEntity; |
20
|
|
|
use Sulu\Component\Rest\ApiWrapper; |
21
|
|
|
|
22
|
|
|
class Address extends ApiWrapper |
23
|
|
|
{ |
24
|
|
|
public function __construct(AddressEntity $account, $locale) |
25
|
|
|
{ |
26
|
|
|
$this->entity = $account; |
27
|
|
|
$this->locale = $locale; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
public function setStreet(string $street): self |
31
|
|
|
{ |
32
|
|
|
$this->entity->setStreet($street); |
33
|
|
|
|
34
|
|
|
return $this; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @VirtualProperty |
39
|
|
|
* @SerializedName("street") |
40
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
41
|
|
|
*/ |
42
|
|
|
public function getStreet(): ?string |
43
|
|
|
{ |
44
|
|
|
return $this->entity->getStreet(); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function setNumber(string $number): self |
48
|
|
|
{ |
49
|
|
|
$this->entity->setNumber($number); |
50
|
|
|
|
51
|
|
|
return $this; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @VirtualProperty |
56
|
|
|
* @SerializedName("number") |
57
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
58
|
|
|
*/ |
59
|
|
|
public function getNumber(): ?string |
60
|
|
|
{ |
61
|
|
|
return $this->entity->getNumber(); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
public function setAddition(string $addition): self |
65
|
|
|
{ |
66
|
|
|
$this->entity->setAddition($addition); |
67
|
|
|
|
68
|
|
|
return $this; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @VirtualProperty |
73
|
|
|
* @SerializedName("addition") |
74
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
75
|
|
|
*/ |
76
|
|
|
public function getAddition(): ?string |
77
|
|
|
{ |
78
|
|
|
return $this->entity->getAddition(); |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
public function setZip(string $zip): self |
82
|
|
|
{ |
83
|
|
|
$this->entity->setZip($zip); |
84
|
|
|
|
85
|
|
|
return $this; |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @VirtualProperty |
90
|
|
|
* @SerializedName("zip") |
91
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
92
|
|
|
*/ |
93
|
|
|
public function getZip(): ?string |
94
|
|
|
{ |
95
|
|
|
return $this->entity->getZip(); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
public function setCity($city): self |
99
|
|
|
{ |
100
|
|
|
$this->entity->setCity($city); |
101
|
|
|
|
102
|
|
|
return $this; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* @VirtualProperty |
107
|
|
|
* @SerializedName("city") |
108
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
109
|
|
|
*/ |
110
|
|
|
public function getCity(): ?string |
111
|
|
|
{ |
112
|
|
|
return $this->entity->getCity(); |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
public function setState(string $state): self |
116
|
|
|
{ |
117
|
|
|
$this->entity->setState($state); |
118
|
|
|
|
119
|
|
|
return $this; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @VirtualProperty |
124
|
|
|
* @SerializedName("state") |
125
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
126
|
|
|
*/ |
127
|
|
|
public function getState(): ?string |
128
|
|
|
{ |
129
|
|
|
return $this->entity->getState(); |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @VirtualProperty |
134
|
|
|
* @SerializedName("id") |
135
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
136
|
|
|
*/ |
137
|
|
|
public function getId(): ?int |
138
|
|
|
{ |
139
|
|
|
return $this->entity->getId(); |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
public function setAddressType(AddressTypeEntity $addressType): self |
143
|
|
|
{ |
144
|
|
|
$this->entity->setAddressType($addressType); |
145
|
|
|
|
146
|
|
|
return $this; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* @VirtualProperty |
151
|
|
|
* @SerializedName("addressType") |
152
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
153
|
|
|
*/ |
154
|
|
|
public function getAddressType(): ?int |
155
|
|
|
{ |
156
|
|
|
return $this->entity->getAddressType()->getId(); |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
public function setCountry(CountryEntity $country = null): self |
160
|
|
|
{ |
161
|
|
|
$this->entity->setCountry($country); |
162
|
|
|
|
163
|
|
|
return $this; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* @VirtualProperty |
168
|
|
|
* @SerializedName("country") |
169
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
170
|
|
|
*/ |
171
|
|
|
public function getCountry(): ?int |
172
|
|
|
{ |
173
|
|
|
$country = $this->entity->getCountry(); |
174
|
|
|
|
175
|
|
|
if (!$country) { |
176
|
|
|
return null; |
177
|
|
|
} |
178
|
|
|
|
179
|
|
|
return $country->getId(); |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
public function setPrimaryAddress(bool $primaryAddress): self |
183
|
|
|
{ |
184
|
|
|
$this->entity->setPrimaryAddress($primaryAddress); |
185
|
|
|
|
186
|
|
|
return $this; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* @VirtualProperty |
191
|
|
|
* @SerializedName("primaryAddress") |
192
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
193
|
|
|
*/ |
194
|
|
|
public function getPrimaryAddress(): ?bool |
195
|
|
|
{ |
196
|
|
|
return $this->entity->getPrimaryAddress(); |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
public function setDeliveryAddress(bool $deliveryAddress): self |
200
|
|
|
{ |
201
|
|
|
$this->entity->setDeliveryAddress($deliveryAddress); |
202
|
|
|
|
203
|
|
|
return $this; |
204
|
|
|
} |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* @VirtualProperty |
208
|
|
|
* @SerializedName("deliveryAddress") |
209
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
210
|
|
|
*/ |
211
|
|
|
public function getDeliveryAddress(): ?bool |
212
|
|
|
{ |
213
|
|
|
return $this->entity->getDeliveryAddress(); |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
public function setBillingAddress(bool $billingAddress) |
217
|
|
|
{ |
218
|
|
|
$this->entity->setBillingAddress($billingAddress); |
219
|
|
|
|
220
|
|
|
return $this; |
221
|
|
|
} |
222
|
|
|
|
223
|
|
|
/** |
224
|
|
|
* @VirtualProperty |
225
|
|
|
* @SerializedName("billingAddress") |
226
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
227
|
|
|
*/ |
228
|
|
|
public function getBillingAddress(): ?bool |
229
|
|
|
{ |
230
|
|
|
return $this->entity->getBillingAddress(); |
231
|
|
|
} |
232
|
|
|
|
233
|
|
|
public function setPostboxNumber(string $postboxNumber): self |
234
|
|
|
{ |
235
|
|
|
$this->entity->setPostboxNumber($postboxNumber); |
236
|
|
|
|
237
|
|
|
return $this; |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* @VirtualProperty |
242
|
|
|
* @SerializedName("postboxNumber") |
243
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
244
|
|
|
*/ |
245
|
|
|
public function getPostboxNumber(): ?string |
246
|
|
|
{ |
247
|
|
|
return $this->entity->getPostboxNumber(); |
248
|
|
|
} |
249
|
|
|
|
250
|
|
|
public function setPostboxPostcode(string $postboxPostcode): self |
251
|
|
|
{ |
252
|
|
|
$this->entity->setPostboxPostcode($postboxPostcode); |
253
|
|
|
|
254
|
|
|
return $this; |
255
|
|
|
} |
256
|
|
|
|
257
|
|
|
/** |
258
|
|
|
* @VirtualProperty |
259
|
|
|
* @SerializedName("postboxPostcode") |
260
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
261
|
|
|
*/ |
262
|
|
|
public function getPostboxPostcode(): ?string |
263
|
|
|
{ |
264
|
|
|
return $this->entity->getPostboxPostcode(); |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
public function setPostboxCity(string $postboxCity): self |
268
|
|
|
{ |
269
|
|
|
$this->entity->setPostboxCity($postboxCity); |
270
|
|
|
|
271
|
|
|
return $this; |
272
|
|
|
} |
273
|
|
|
|
274
|
|
|
/** |
275
|
|
|
* @VirtualProperty |
276
|
|
|
* @SerializedName("postboxCity") |
277
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
278
|
|
|
*/ |
279
|
|
|
public function getPostboxCity(): ?string |
280
|
|
|
{ |
281
|
|
|
return $this->entity->getPostboxCity(); |
282
|
|
|
} |
283
|
|
|
|
284
|
|
|
public function addContactAddress(ContactAddress $contactAddresses): self |
285
|
|
|
{ |
286
|
|
|
$this->entity->addContactAddress($contactAddresses); |
287
|
|
|
|
288
|
|
|
return $this; |
289
|
|
|
} |
290
|
|
|
|
291
|
|
|
public function removeContactAddress(ContactAddress $contactAddresses): self |
292
|
|
|
{ |
293
|
|
|
$this->entity->removeContactAddress($contactAddresses); |
294
|
|
|
|
295
|
|
|
return $this; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
public function getContactAddresses() |
299
|
|
|
{ |
300
|
|
|
return $this->entity->getContactAddresses(); |
301
|
|
|
} |
302
|
|
|
|
303
|
|
|
public function addAccountAddress(AccountAddress $accountAddresses): self |
304
|
|
|
{ |
305
|
|
|
$this->entity->addAccountAddress($accountAddresses); |
306
|
|
|
|
307
|
|
|
return $this; |
308
|
|
|
} |
309
|
|
|
|
310
|
|
|
public function removeAccountAddress(AccountAddress $accountAddresses): self |
311
|
|
|
{ |
312
|
|
|
$this->entity->removeAccountAddress($accountAddresses); |
313
|
|
|
|
314
|
|
|
return $this; |
315
|
|
|
} |
316
|
|
|
|
317
|
|
|
public function getAccountAddresses() |
318
|
|
|
{ |
319
|
|
|
return $this->entity->getAccountAddresses(); |
320
|
|
|
} |
321
|
|
|
|
322
|
|
|
public function setNote(string $note): self |
323
|
|
|
{ |
324
|
|
|
$this->entity->setNote($note); |
325
|
|
|
|
326
|
|
|
return $this; |
327
|
|
|
} |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* @VirtualProperty |
331
|
|
|
* @SerializedName("note") |
332
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
333
|
|
|
*/ |
334
|
|
|
public function getNote(): ?string |
335
|
|
|
{ |
336
|
|
|
return $this->entity->getNote(); |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
public function setTitle(string $title): self |
340
|
|
|
{ |
341
|
|
|
$this->entity->setTitle($title); |
342
|
|
|
|
343
|
|
|
return $this; |
344
|
|
|
} |
345
|
|
|
|
346
|
|
|
/** |
347
|
|
|
* @VirtualProperty |
348
|
|
|
* @SerializedName("title") |
349
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
350
|
|
|
*/ |
351
|
|
|
public function getTitle(): ?string |
352
|
|
|
{ |
353
|
|
|
return $this->entity->getTitle(); |
354
|
|
|
} |
355
|
|
|
|
356
|
|
|
/** |
357
|
|
|
* @VirtualProperty |
358
|
|
|
* @SerializedName("latitude") |
359
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
360
|
|
|
*/ |
361
|
|
|
public function getLatitude(): ?float |
362
|
|
|
{ |
363
|
|
|
return $this->entity->getLatitude(); |
364
|
|
|
} |
365
|
|
|
|
366
|
|
|
public function setLatitude(float $latitude): self |
367
|
|
|
{ |
368
|
|
|
$this->entity->setLatitude($latitude); |
369
|
|
|
|
370
|
|
|
return $this; |
371
|
|
|
} |
372
|
|
|
|
373
|
|
|
/** |
374
|
|
|
* @VirtualProperty |
375
|
|
|
* @SerializedName("longitude") |
376
|
|
|
* @Groups({"fullContact", "fullAccount"}) |
377
|
|
|
*/ |
378
|
|
|
public function getLongitude(): ?float |
379
|
|
|
{ |
380
|
|
|
return $this->entity->getLongitude(); |
381
|
|
|
} |
382
|
|
|
|
383
|
|
|
public function setLongitude(float $longitude): self |
384
|
|
|
{ |
385
|
|
|
$this->entity->setLongitude($longitude); |
386
|
|
|
|
387
|
|
|
return $this; |
388
|
|
|
} |
389
|
|
|
} |
390
|
|
|
|