commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
DivisionDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
19 use stdClass;
20 
24 final class DivisionDraftModel extends JsonObjectModel implements DivisionDraft
25 {
26  public const DISCRIMINATOR_VALUE = 'Division';
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 
85  protected $approvalRuleMode;
86 
91  protected $addresses;
92 
97  protected $shippingAddresses;
98 
104 
109  protected $billingAddresses;
110 
116 
121  protected $custom;
122 
127  protected $parentUnit;
128 
129 
133  public function __construct(
134  ?string $key = null,
135  ?string $status = null,
137  ?string $storeMode = null,
138  ?string $name = null,
139  ?string $contactEmail = null,
140  ?string $associateMode = null,
142  ?string $approvalRuleMode = null,
144  ?array $shippingAddresses = null,
145  ?int $defaultShippingAddress = null,
146  ?array $billingAddresses = null,
147  ?int $defaultBillingAddress = null,
148  ?CustomFieldsDraft $custom = null,
150  ?string $unitType = null
151  ) {
152  $this->key = $key;
153  $this->status = $status;
154  $this->stores = $stores;
155  $this->storeMode = $storeMode;
156  $this->name = $name;
157  $this->contactEmail = $contactEmail;
158  $this->associateMode = $associateMode;
159  $this->associates = $associates;
160  $this->approvalRuleMode = $approvalRuleMode;
161  $this->addresses = $addresses;
162  $this->shippingAddresses = $shippingAddresses;
163  $this->defaultShippingAddress = $defaultShippingAddress;
164  $this->billingAddresses = $billingAddresses;
165  $this->defaultBillingAddress = $defaultBillingAddress;
166  $this->custom = $custom;
167  $this->parentUnit = $parentUnit;
168  $this->unitType = $unitType ?? self::DISCRIMINATOR_VALUE;
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 
321  public function getAssociateMode()
322  {
323  if (is_null($this->associateMode)) {
325  $data = $this->raw(self::FIELD_ASSOCIATE_MODE);
326  if (is_null($data)) {
327  return null;
328  }
329  $this->associateMode = (string) $data;
330  }
331 
332  return $this->associateMode;
333  }
334 
341  public function getAssociates()
342  {
343  if (is_null($this->associates)) {
345  $data = $this->raw(self::FIELD_ASSOCIATES);
346  if (is_null($data)) {
347  return null;
348  }
349  $this->associates = AssociateDraftCollection::fromArray($data);
350  }
351 
352  return $this->associates;
353  }
354 
361  public function getApprovalRuleMode()
362  {
363  if (is_null($this->approvalRuleMode)) {
365  $data = $this->raw(self::FIELD_APPROVAL_RULE_MODE);
366  if (is_null($data)) {
367  return null;
368  }
369  $this->approvalRuleMode = (string) $data;
370  }
371 
373  }
374 
381  public function getAddresses()
382  {
383  if (is_null($this->addresses)) {
385  $data = $this->raw(self::FIELD_ADDRESSES);
386  if (is_null($data)) {
387  return null;
388  }
389  $this->addresses = BaseAddressCollection::fromArray($data);
390  }
391 
392  return $this->addresses;
393  }
394 
402  public function getShippingAddresses()
403  {
404  if (is_null($this->shippingAddresses)) {
406  $data = $this->raw(self::FIELD_SHIPPING_ADDRESSES);
407  if (is_null($data)) {
408  return null;
409  }
410  $this->shippingAddresses = $data;
411  }
412 
414  }
415 
422  public function getDefaultShippingAddress()
423  {
424  if (is_null($this->defaultShippingAddress)) {
426  $data = $this->raw(self::FIELD_DEFAULT_SHIPPING_ADDRESS);
427  if (is_null($data)) {
428  return null;
429  }
430  $this->defaultShippingAddress = (int) $data;
431  }
432 
434  }
435 
443  public function getBillingAddresses()
444  {
445  if (is_null($this->billingAddresses)) {
447  $data = $this->raw(self::FIELD_BILLING_ADDRESSES);
448  if (is_null($data)) {
449  return null;
450  }
451  $this->billingAddresses = $data;
452  }
453 
455  }
456 
463  public function getDefaultBillingAddress()
464  {
465  if (is_null($this->defaultBillingAddress)) {
467  $data = $this->raw(self::FIELD_DEFAULT_BILLING_ADDRESS);
468  if (is_null($data)) {
469  return null;
470  }
471  $this->defaultBillingAddress = (int) $data;
472  }
473 
475  }
476 
483  public function getCustom()
484  {
485  if (is_null($this->custom)) {
487  $data = $this->raw(self::FIELD_CUSTOM);
488  if (is_null($data)) {
489  return null;
490  }
491 
492  $this->custom = CustomFieldsDraftModel::of($data);
493  }
494 
495  return $this->custom;
496  }
497 
504  public function getParentUnit()
505  {
506  if (is_null($this->parentUnit)) {
508  $data = $this->raw(self::FIELD_PARENT_UNIT);
509  if (is_null($data)) {
510  return null;
511  }
512 
513  $this->parentUnit = BusinessUnitResourceIdentifierModel::of($data);
514  }
515 
516  return $this->parentUnit;
517  }
518 
519 
523  public function setKey(?string $key): void
524  {
525  $this->key = $key;
526  }
527 
531  public function setStatus(?string $status): void
532  {
533  $this->status = $status;
534  }
535 
540  {
541  $this->stores = $stores;
542  }
543 
547  public function setStoreMode(?string $storeMode): void
548  {
549  $this->storeMode = $storeMode;
550  }
551 
555  public function setName(?string $name): void
556  {
557  $this->name = $name;
558  }
559 
563  public function setContactEmail(?string $contactEmail): void
564  {
565  $this->contactEmail = $contactEmail;
566  }
567 
571  public function setAssociateMode(?string $associateMode): void
572  {
573  $this->associateMode = $associateMode;
574  }
575 
580  {
581  $this->associates = $associates;
582  }
583 
587  public function setApprovalRuleMode(?string $approvalRuleMode): void
588  {
589  $this->approvalRuleMode = $approvalRuleMode;
590  }
591 
596  {
597  $this->addresses = $addresses;
598  }
599 
603  public function setShippingAddresses(?array $shippingAddresses): void
604  {
605  $this->shippingAddresses = $shippingAddresses;
606  }
607 
612  {
613  $this->defaultShippingAddress = $defaultShippingAddress;
614  }
615 
619  public function setBillingAddresses(?array $billingAddresses): void
620  {
621  $this->billingAddresses = $billingAddresses;
622  }
623 
628  {
629  $this->defaultBillingAddress = $defaultBillingAddress;
630  }
631 
635  public function setCustom(?CustomFieldsDraft $custom): void
636  {
637  $this->custom = $custom;
638  }
639 
644  {
645  $this->parentUnit = $parentUnit;
646  }
647 }
setAssociates(?AssociateDraftCollection $associates)
__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, ?BusinessUnitResourceIdentifier $parentUnit=null, ?string $unitType=null)
setParentUnit(?BusinessUnitResourceIdentifier $parentUnit)
setStores(?StoreResourceIdentifierCollection $stores)