commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
BusinessUnitImportModel.php
1<?php
2
3declare(strict_types=1);
10
19use stdClass;
20
25{
26 public const DISCRIMINATOR_VALUE = '';
31 protected $unitType;
32
37 protected $key;
38
43 protected $name;
44
49 protected $status;
50
55 protected $contactEmail;
56
61 protected $associates;
62
67 protected $addresses;
68
74
80
86
92
97 protected $stores;
98
103 protected $custom;
104
109 private static $discriminatorClasses = [
110 'Company' => CompanyBusinessUnitImportModel::class,
111 'Division' => DivisionBusinessUnitImportModel::class,
112 ];
113
117 public function __construct(
118 ?string $key = null,
119 ?string $name = null,
120 ?string $status = null,
121 ?string $contactEmail = null,
124 ?array $shippingAddresses = null,
125 ?int $defaultShippingAddress = null,
126 ?array $billingAddresses = null,
127 ?int $defaultBillingAddress = null,
129 ?Custom $custom = null,
130 ?string $unitType = null
131 ) {
132 $this->key = $key;
133 $this->name = $name;
134 $this->status = $status;
135 $this->contactEmail = $contactEmail;
136 $this->associates = $associates;
137 $this->addresses = $addresses;
138 $this->shippingAddresses = $shippingAddresses;
139 $this->defaultShippingAddress = $defaultShippingAddress;
140 $this->billingAddresses = $billingAddresses;
141 $this->defaultBillingAddress = $defaultBillingAddress;
142 $this->stores = $stores;
143 $this->custom = $custom;
144 $this->unitType = $unitType;
145 }
146
153 public function getUnitType()
154 {
155 if (is_null($this->unitType)) {
157 $data = $this->raw(self::FIELD_UNIT_TYPE);
158 if (is_null($data)) {
159 return null;
160 }
161 $this->unitType = (string) $data;
162 }
163
164 return $this->unitType;
165 }
166
173 public function getKey()
174 {
175 if (is_null($this->key)) {
177 $data = $this->raw(self::FIELD_KEY);
178 if (is_null($data)) {
179 return null;
180 }
181 $this->key = (string) $data;
182 }
183
184 return $this->key;
185 }
186
193 public function getName()
194 {
195 if (is_null($this->name)) {
197 $data = $this->raw(self::FIELD_NAME);
198 if (is_null($data)) {
199 return null;
200 }
201 $this->name = (string) $data;
202 }
203
204 return $this->name;
205 }
206
213 public function getStatus()
214 {
215 if (is_null($this->status)) {
217 $data = $this->raw(self::FIELD_STATUS);
218 if (is_null($data)) {
219 return null;
220 }
221 $this->status = (string) $data;
222 }
223
224 return $this->status;
225 }
226
233 public function getContactEmail()
234 {
235 if (is_null($this->contactEmail)) {
237 $data = $this->raw(self::FIELD_CONTACT_EMAIL);
238 if (is_null($data)) {
239 return null;
240 }
241 $this->contactEmail = (string) $data;
242 }
243
244 return $this->contactEmail;
245 }
246
253 public function getAssociates()
254 {
255 if (is_null($this->associates)) {
257 $data = $this->raw(self::FIELD_ASSOCIATES);
258 if (is_null($data)) {
259 return null;
260 }
261 $this->associates = AssociateDraftCollection::fromArray($data);
262 }
263
264 return $this->associates;
265 }
266
273 public function getAddresses()
274 {
275 if (is_null($this->addresses)) {
277 $data = $this->raw(self::FIELD_ADDRESSES);
278 if (is_null($data)) {
279 return null;
280 }
281 $this->addresses = AddressCollection::fromArray($data);
282 }
283
284 return $this->addresses;
285 }
286
293 public function getShippingAddresses()
294 {
295 if (is_null($this->shippingAddresses)) {
297 $data = $this->raw(self::FIELD_SHIPPING_ADDRESSES);
298 if (is_null($data)) {
299 return null;
300 }
301 $this->shippingAddresses = $data;
302 }
303
305 }
306
314 {
315 if (is_null($this->defaultShippingAddress)) {
317 $data = $this->raw(self::FIELD_DEFAULT_SHIPPING_ADDRESS);
318 if (is_null($data)) {
319 return null;
320 }
321 $this->defaultShippingAddress = (int) $data;
322 }
323
325 }
326
333 public function getBillingAddresses()
334 {
335 if (is_null($this->billingAddresses)) {
337 $data = $this->raw(self::FIELD_BILLING_ADDRESSES);
338 if (is_null($data)) {
339 return null;
340 }
341 $this->billingAddresses = $data;
342 }
343
345 }
346
353 public function getDefaultBillingAddress()
354 {
355 if (is_null($this->defaultBillingAddress)) {
357 $data = $this->raw(self::FIELD_DEFAULT_BILLING_ADDRESS);
358 if (is_null($data)) {
359 return null;
360 }
361 $this->defaultBillingAddress = (int) $data;
362 }
363
365 }
366
373 public function getStores()
374 {
375 if (is_null($this->stores)) {
377 $data = $this->raw(self::FIELD_STORES);
378 if (is_null($data)) {
379 return null;
380 }
381 $this->stores = StoreKeyReferenceCollection::fromArray($data);
382 }
383
384 return $this->stores;
385 }
386
393 public function getCustom()
394 {
395 if (is_null($this->custom)) {
397 $data = $this->raw(self::FIELD_CUSTOM);
398 if (is_null($data)) {
399 return null;
400 }
401
402 $this->custom = CustomModel::of($data);
403 }
404
405 return $this->custom;
406 }
407
408
412 public function setKey(?string $key): void
413 {
414 $this->key = $key;
415 }
416
420 public function setName(?string $name): void
421 {
422 $this->name = $name;
423 }
424
428 public function setStatus(?string $status): void
429 {
430 $this->status = $status;
431 }
432
436 public function setContactEmail(?string $contactEmail): void
437 {
438 $this->contactEmail = $contactEmail;
439 }
440
445 {
446 $this->associates = $associates;
447 }
448
453 {
454 $this->addresses = $addresses;
455 }
456
460 public function setShippingAddresses(?array $shippingAddresses): void
461 {
462 $this->shippingAddresses = $shippingAddresses;
463 }
464
469 {
470 $this->defaultShippingAddress = $defaultShippingAddress;
471 }
472
476 public function setBillingAddresses(?array $billingAddresses): void
477 {
478 $this->billingAddresses = $billingAddresses;
479 }
480
485 {
486 $this->defaultBillingAddress = $defaultBillingAddress;
487 }
488
493 {
494 $this->stores = $stores;
495 }
496
500 public function setCustom(?Custom $custom): void
501 {
502 $this->custom = $custom;
503 }
504
505
506
511 public static function resolveDiscriminatorClass($value): string
512 {
514 if (is_object($value) && isset($value->$fieldName)) {
516 $discriminatorValue = $value->$fieldName;
517 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
518 return self::$discriminatorClasses[$discriminatorValue];
519 }
520 }
521 if (is_array($value) && isset($value[$fieldName])) {
523 $discriminatorValue = $value[$fieldName];
524 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
525 return self::$discriminatorClasses[$discriminatorValue];
526 }
527 }
528
530 $type = BusinessUnitImportModel::class;
531 return $type;
532 }
533}
__construct(?string $key=null, ?string $name=null, ?string $status=null, ?string $contactEmail=null, ?AssociateDraftCollection $associates=null, ?AddressCollection $addresses=null, ?array $shippingAddresses=null, ?int $defaultShippingAddress=null, ?array $billingAddresses=null, ?int $defaultBillingAddress=null, ?StoreKeyReferenceCollection $stores=null, ?Custom $custom=null, ?string $unitType=null)
static fromArray(array $data)