commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
BusinessUnitDraftModel.php
1<?php
2
3declare(strict_types=1);
10
19use stdClass;
20
25{
26 public const DISCRIMINATOR_VALUE = '';
31 protected $key;
32
37 protected $status;
38
43 protected $stores;
44
49 protected $storeMode;
50
55 protected $unitType;
56
61 protected $name;
62
67 protected $contactEmail;
68
73 protected $associateMode;
74
79 protected $associates;
80
86
91 protected $addresses;
92
98
104
110
116
121 protected $custom;
122
127 private static $discriminatorClasses = [
128 'Company' => CompanyDraftModel::class,
129 'Division' => DivisionDraftModel::class,
130 ];
131
135 public function __construct(
136 ?string $key = null,
137 ?string $status = null,
139 ?string $storeMode = null,
140 ?string $name = null,
141 ?string $contactEmail = null,
142 ?string $associateMode = null,
144 ?string $approvalRuleMode = null,
146 ?array $shippingAddresses = null,
147 ?int $defaultShippingAddress = null,
148 ?array $billingAddresses = null,
149 ?int $defaultBillingAddress = null,
151 ?string $unitType = null
152 ) {
153 $this->key = $key;
154 $this->status = $status;
155 $this->stores = $stores;
156 $this->storeMode = $storeMode;
157 $this->name = $name;
158 $this->contactEmail = $contactEmail;
159 $this->associateMode = $associateMode;
160 $this->associates = $associates;
161 $this->approvalRuleMode = $approvalRuleMode;
162 $this->addresses = $addresses;
163 $this->shippingAddresses = $shippingAddresses;
164 $this->defaultShippingAddress = $defaultShippingAddress;
165 $this->billingAddresses = $billingAddresses;
166 $this->defaultBillingAddress = $defaultBillingAddress;
167 $this->custom = $custom;
168 $this->unitType = $unitType;
169 }
170
177 public function getKey()
178 {
179 if (is_null($this->key)) {
181 $data = $this->raw(self::FIELD_KEY);
182 if (is_null($data)) {
183 return null;
184 }
185 $this->key = (string) $data;
186 }
187
188 return $this->key;
189 }
190
197 public function getStatus()
198 {
199 if (is_null($this->status)) {
201 $data = $this->raw(self::FIELD_STATUS);
202 if (is_null($data)) {
203 return null;
204 }
205 $this->status = (string) $data;
206 }
207
208 return $this->status;
209 }
210
220 public function getStores()
221 {
222 if (is_null($this->stores)) {
224 $data = $this->raw(self::FIELD_STORES);
225 if (is_null($data)) {
226 return null;
227 }
228 $this->stores = StoreResourceIdentifierCollection::fromArray($data);
229 }
230
231 return $this->stores;
232 }
233
241 public function getStoreMode()
242 {
243 if (is_null($this->storeMode)) {
245 $data = $this->raw(self::FIELD_STORE_MODE);
246 if (is_null($data)) {
247 return null;
248 }
249 $this->storeMode = (string) $data;
250 }
251
252 return $this->storeMode;
253 }
254
261 public function getUnitType()
262 {
263 if (is_null($this->unitType)) {
265 $data = $this->raw(self::FIELD_UNIT_TYPE);
266 if (is_null($data)) {
267 return null;
268 }
269 $this->unitType = (string) $data;
270 }
271
272 return $this->unitType;
273 }
274
281 public function getName()
282 {
283 if (is_null($this->name)) {
285 $data = $this->raw(self::FIELD_NAME);
286 if (is_null($data)) {
287 return null;
288 }
289 $this->name = (string) $data;
290 }
291
292 return $this->name;
293 }
294
301 public function getContactEmail()
302 {
303 if (is_null($this->contactEmail)) {
305 $data = $this->raw(self::FIELD_CONTACT_EMAIL);
306 if (is_null($data)) {
307 return null;
308 }
309 $this->contactEmail = (string) $data;
310 }
311
312 return $this->contactEmail;
313 }
314
322 public function getAssociateMode()
323 {
324 if (is_null($this->associateMode)) {
326 $data = $this->raw(self::FIELD_ASSOCIATE_MODE);
327 if (is_null($data)) {
328 return null;
329 }
330 $this->associateMode = (string) $data;
331 }
332
334 }
335
342 public function getAssociates()
343 {
344 if (is_null($this->associates)) {
346 $data = $this->raw(self::FIELD_ASSOCIATES);
347 if (is_null($data)) {
348 return null;
349 }
350 $this->associates = AssociateDraftCollection::fromArray($data);
351 }
352
353 return $this->associates;
354 }
355
364 public function getApprovalRuleMode()
365 {
366 if (is_null($this->approvalRuleMode)) {
368 $data = $this->raw(self::FIELD_APPROVAL_RULE_MODE);
369 if (is_null($data)) {
370 return null;
371 }
372 $this->approvalRuleMode = (string) $data;
373 }
374
376 }
377
384 public function getAddresses()
385 {
386 if (is_null($this->addresses)) {
388 $data = $this->raw(self::FIELD_ADDRESSES);
389 if (is_null($data)) {
390 return null;
391 }
392 $this->addresses = BaseAddressCollection::fromArray($data);
393 }
394
395 return $this->addresses;
396 }
397
405 public function getShippingAddresses()
406 {
407 if (is_null($this->shippingAddresses)) {
409 $data = $this->raw(self::FIELD_SHIPPING_ADDRESSES);
410 if (is_null($data)) {
411 return null;
412 }
413 $this->shippingAddresses = $data;
414 }
415
417 }
418
426 {
427 if (is_null($this->defaultShippingAddress)) {
429 $data = $this->raw(self::FIELD_DEFAULT_SHIPPING_ADDRESS);
430 if (is_null($data)) {
431 return null;
432 }
433 $this->defaultShippingAddress = (int) $data;
434 }
435
437 }
438
446 public function getBillingAddresses()
447 {
448 if (is_null($this->billingAddresses)) {
450 $data = $this->raw(self::FIELD_BILLING_ADDRESSES);
451 if (is_null($data)) {
452 return null;
453 }
454 $this->billingAddresses = $data;
455 }
456
458 }
459
466 public function getDefaultBillingAddress()
467 {
468 if (is_null($this->defaultBillingAddress)) {
470 $data = $this->raw(self::FIELD_DEFAULT_BILLING_ADDRESS);
471 if (is_null($data)) {
472 return null;
473 }
474 $this->defaultBillingAddress = (int) $data;
475 }
476
478 }
479
486 public function getCustom()
487 {
488 if (is_null($this->custom)) {
490 $data = $this->raw(self::FIELD_CUSTOM);
491 if (is_null($data)) {
492 return null;
493 }
494
495 $this->custom = CustomFieldsDraftModel::of($data);
496 }
497
498 return $this->custom;
499 }
500
501
505 public function setKey(?string $key): void
506 {
507 $this->key = $key;
508 }
509
513 public function setStatus(?string $status): void
514 {
515 $this->status = $status;
516 }
517
522 {
523 $this->stores = $stores;
524 }
525
529 public function setStoreMode(?string $storeMode): void
530 {
531 $this->storeMode = $storeMode;
532 }
533
537 public function setName(?string $name): void
538 {
539 $this->name = $name;
540 }
541
545 public function setContactEmail(?string $contactEmail): void
546 {
547 $this->contactEmail = $contactEmail;
548 }
549
553 public function setAssociateMode(?string $associateMode): void
554 {
555 $this->associateMode = $associateMode;
556 }
557
562 {
563 $this->associates = $associates;
564 }
565
569 public function setApprovalRuleMode(?string $approvalRuleMode): void
570 {
571 $this->approvalRuleMode = $approvalRuleMode;
572 }
573
578 {
579 $this->addresses = $addresses;
580 }
581
585 public function setShippingAddresses(?array $shippingAddresses): void
586 {
587 $this->shippingAddresses = $shippingAddresses;
588 }
589
594 {
595 $this->defaultShippingAddress = $defaultShippingAddress;
596 }
597
601 public function setBillingAddresses(?array $billingAddresses): void
602 {
603 $this->billingAddresses = $billingAddresses;
604 }
605
610 {
611 $this->defaultBillingAddress = $defaultBillingAddress;
612 }
613
617 public function setCustom(?CustomFieldsDraft $custom): void
618 {
619 $this->custom = $custom;
620 }
621
622
623
628 public static function resolveDiscriminatorClass($value): string
629 {
631 if (is_object($value) && isset($value->$fieldName)) {
633 $discriminatorValue = $value->$fieldName;
634 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
635 return self::$discriminatorClasses[$discriminatorValue];
636 }
637 }
638 if (is_array($value) && isset($value[$fieldName])) {
640 $discriminatorValue = $value[$fieldName];
641 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
642 return self::$discriminatorClasses[$discriminatorValue];
643 }
644 }
645
647 $type = BusinessUnitDraftModel::class;
648 return $type;
649 }
650}
__construct(?string $key=null, ?string $status=null, ?StoreResourceIdentifierCollection $stores=null, ?string $storeMode=null, ?string $name=null, ?string $contactEmail=null, ?string $associateMode=null, ?AssociateDraftCollection $associates=null, ?string $approvalRuleMode=null, ?BaseAddressCollection $addresses=null, ?array $shippingAddresses=null, ?int $defaultShippingAddress=null, ?array $billingAddresses=null, ?int $defaultBillingAddress=null, ?CustomFieldsDraft $custom=null, ?string $unitType=null)
static fromArray(array $data)