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
20use stdClass;
21
26{
27 public const DISCRIMINATOR_VALUE = '';
32 protected $key;
33
38 protected $status;
39
44 protected $stores;
45
50 protected $storeMode;
51
56 protected $unitType;
57
62 protected $name;
63
68 protected $contactEmail;
69
74 protected $associateMode;
75
80 protected $associates;
81
87
92 protected $addresses;
93
99
105
111
117
122 protected $custom;
123
129
134 private static $discriminatorClasses = [
135 'Company' => CompanyDraftModel::class,
136 'Division' => DivisionDraftModel::class,
137 ];
138
142 public function __construct(
143 ?string $key = null,
144 ?string $status = null,
146 ?string $storeMode = null,
147 ?string $name = null,
148 ?string $contactEmail = null,
149 ?string $associateMode = null,
151 ?string $approvalRuleMode = null,
153 ?array $shippingAddresses = null,
154 ?int $defaultShippingAddress = null,
155 ?array $billingAddresses = null,
156 ?int $defaultBillingAddress = null,
159 ?string $unitType = null
160 ) {
161 $this->key = $key;
162 $this->status = $status;
163 $this->stores = $stores;
164 $this->storeMode = $storeMode;
165 $this->name = $name;
166 $this->contactEmail = $contactEmail;
167 $this->associateMode = $associateMode;
168 $this->associates = $associates;
169 $this->approvalRuleMode = $approvalRuleMode;
170 $this->addresses = $addresses;
171 $this->shippingAddresses = $shippingAddresses;
172 $this->defaultShippingAddress = $defaultShippingAddress;
173 $this->billingAddresses = $billingAddresses;
174 $this->defaultBillingAddress = $defaultBillingAddress;
175 $this->custom = $custom;
176 $this->customerGroupAssignments = $customerGroupAssignments;
177 $this->unitType = $unitType;
178 }
179
186 public function getKey()
187 {
188 if (is_null($this->key)) {
190 $data = $this->raw(self::FIELD_KEY);
191 if (is_null($data)) {
192 return null;
193 }
194 $this->key = (string) $data;
195 }
196
197 return $this->key;
198 }
199
206 public function getStatus()
207 {
208 if (is_null($this->status)) {
210 $data = $this->raw(self::FIELD_STATUS);
211 if (is_null($data)) {
212 return null;
213 }
214 $this->status = (string) $data;
215 }
216
217 return $this->status;
218 }
219
229 public function getStores()
230 {
231 if (is_null($this->stores)) {
233 $data = $this->raw(self::FIELD_STORES);
234 if (is_null($data)) {
235 return null;
236 }
237 $this->stores = StoreResourceIdentifierCollection::fromArray($data);
238 }
239
240 return $this->stores;
241 }
242
250 public function getStoreMode()
251 {
252 if (is_null($this->storeMode)) {
254 $data = $this->raw(self::FIELD_STORE_MODE);
255 if (is_null($data)) {
256 return null;
257 }
258 $this->storeMode = (string) $data;
259 }
260
261 return $this->storeMode;
262 }
263
270 public function getUnitType()
271 {
272 if (is_null($this->unitType)) {
274 $data = $this->raw(self::FIELD_UNIT_TYPE);
275 if (is_null($data)) {
276 return null;
277 }
278 $this->unitType = (string) $data;
279 }
280
281 return $this->unitType;
282 }
283
290 public function getName()
291 {
292 if (is_null($this->name)) {
294 $data = $this->raw(self::FIELD_NAME);
295 if (is_null($data)) {
296 return null;
297 }
298 $this->name = (string) $data;
299 }
300
301 return $this->name;
302 }
303
310 public function getContactEmail()
311 {
312 if (is_null($this->contactEmail)) {
314 $data = $this->raw(self::FIELD_CONTACT_EMAIL);
315 if (is_null($data)) {
316 return null;
317 }
318 $this->contactEmail = (string) $data;
319 }
320
321 return $this->contactEmail;
322 }
323
331 public function getAssociateMode()
332 {
333 if (is_null($this->associateMode)) {
335 $data = $this->raw(self::FIELD_ASSOCIATE_MODE);
336 if (is_null($data)) {
337 return null;
338 }
339 $this->associateMode = (string) $data;
340 }
341
343 }
344
351 public function getAssociates()
352 {
353 if (is_null($this->associates)) {
355 $data = $this->raw(self::FIELD_ASSOCIATES);
356 if (is_null($data)) {
357 return null;
358 }
359 $this->associates = AssociateDraftCollection::fromArray($data);
360 }
361
362 return $this->associates;
363 }
364
373 public function getApprovalRuleMode()
374 {
375 if (is_null($this->approvalRuleMode)) {
377 $data = $this->raw(self::FIELD_APPROVAL_RULE_MODE);
378 if (is_null($data)) {
379 return null;
380 }
381 $this->approvalRuleMode = (string) $data;
382 }
383
385 }
386
393 public function getAddresses()
394 {
395 if (is_null($this->addresses)) {
397 $data = $this->raw(self::FIELD_ADDRESSES);
398 if (is_null($data)) {
399 return null;
400 }
401 $this->addresses = BaseAddressCollection::fromArray($data);
402 }
403
404 return $this->addresses;
405 }
406
414 public function getShippingAddresses()
415 {
416 if (is_null($this->shippingAddresses)) {
418 $data = $this->raw(self::FIELD_SHIPPING_ADDRESSES);
419 if (is_null($data)) {
420 return null;
421 }
422 $this->shippingAddresses = $data;
423 }
424
426 }
427
435 {
436 if (is_null($this->defaultShippingAddress)) {
438 $data = $this->raw(self::FIELD_DEFAULT_SHIPPING_ADDRESS);
439 if (is_null($data)) {
440 return null;
441 }
442 $this->defaultShippingAddress = (int) $data;
443 }
444
446 }
447
455 public function getBillingAddresses()
456 {
457 if (is_null($this->billingAddresses)) {
459 $data = $this->raw(self::FIELD_BILLING_ADDRESSES);
460 if (is_null($data)) {
461 return null;
462 }
463 $this->billingAddresses = $data;
464 }
465
467 }
468
475 public function getDefaultBillingAddress()
476 {
477 if (is_null($this->defaultBillingAddress)) {
479 $data = $this->raw(self::FIELD_DEFAULT_BILLING_ADDRESS);
480 if (is_null($data)) {
481 return null;
482 }
483 $this->defaultBillingAddress = (int) $data;
484 }
485
487 }
488
495 public function getCustom()
496 {
497 if (is_null($this->custom)) {
499 $data = $this->raw(self::FIELD_CUSTOM);
500 if (is_null($data)) {
501 return null;
502 }
503
504 $this->custom = CustomFieldsDraftModel::of($data);
505 }
506
507 return $this->custom;
508 }
509
518 {
519 if (is_null($this->customerGroupAssignments)) {
521 $data = $this->raw(self::FIELD_CUSTOMER_GROUP_ASSIGNMENTS);
522 if (is_null($data)) {
523 return null;
524 }
525 $this->customerGroupAssignments = CustomerGroupAssignmentDraftCollection::fromArray($data);
526 }
527
529 }
530
531
535 public function setKey(?string $key): void
536 {
537 $this->key = $key;
538 }
539
543 public function setStatus(?string $status): void
544 {
545 $this->status = $status;
546 }
547
552 {
553 $this->stores = $stores;
554 }
555
559 public function setStoreMode(?string $storeMode): void
560 {
561 $this->storeMode = $storeMode;
562 }
563
567 public function setName(?string $name): void
568 {
569 $this->name = $name;
570 }
571
575 public function setContactEmail(?string $contactEmail): void
576 {
577 $this->contactEmail = $contactEmail;
578 }
579
583 public function setAssociateMode(?string $associateMode): void
584 {
585 $this->associateMode = $associateMode;
586 }
587
592 {
593 $this->associates = $associates;
594 }
595
599 public function setApprovalRuleMode(?string $approvalRuleMode): void
600 {
601 $this->approvalRuleMode = $approvalRuleMode;
602 }
603
608 {
609 $this->addresses = $addresses;
610 }
611
615 public function setShippingAddresses(?array $shippingAddresses): void
616 {
617 $this->shippingAddresses = $shippingAddresses;
618 }
619
624 {
625 $this->defaultShippingAddress = $defaultShippingAddress;
626 }
627
631 public function setBillingAddresses(?array $billingAddresses): void
632 {
633 $this->billingAddresses = $billingAddresses;
634 }
635
640 {
641 $this->defaultBillingAddress = $defaultBillingAddress;
642 }
643
647 public function setCustom(?CustomFieldsDraft $custom): void
648 {
649 $this->custom = $custom;
650 }
651
656 {
657 $this->customerGroupAssignments = $customerGroupAssignments;
658 }
659
660
661
666 public static function resolveDiscriminatorClass($value): string
667 {
669 if (is_object($value) && isset($value->$fieldName)) {
671 $discriminatorValue = $value->$fieldName;
672 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
673 return self::$discriminatorClasses[$discriminatorValue];
674 }
675 }
676 if (is_array($value) && isset($value[$fieldName])) {
678 $discriminatorValue = $value[$fieldName];
679 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
680 return self::$discriminatorClasses[$discriminatorValue];
681 }
682 }
683
685 $type = BusinessUnitDraftModel::class;
686 return $type;
687 }
688}
__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, ?CustomerGroupAssignmentDraftCollection $customerGroupAssignments=null, ?string $unitType=null)
setCustomerGroupAssignments(?CustomerGroupAssignmentDraftCollection $customerGroupAssignments)
static fromArray(array $data)