commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CompanyDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
19 use stdClass;
20 
24 final class CompanyDraftModel extends JsonObjectModel implements CompanyDraft
25 {
26  public const DISCRIMINATOR_VALUE = 'Company';
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 
123 
127  public function __construct(
128  ?string $key = null,
129  ?string $status = null,
131  ?string $storeMode = null,
132  ?string $name = null,
133  ?string $contactEmail = null,
134  ?string $associateMode = null,
136  ?string $approvalRuleMode = null,
138  ?array $shippingAddresses = null,
139  ?int $defaultShippingAddress = null,
140  ?array $billingAddresses = null,
141  ?int $defaultBillingAddress = null,
142  ?CustomFieldsDraft $custom = null,
143  ?string $unitType = null
144  ) {
145  $this->key = $key;
146  $this->status = $status;
147  $this->stores = $stores;
148  $this->storeMode = $storeMode;
149  $this->name = $name;
150  $this->contactEmail = $contactEmail;
151  $this->associateMode = $associateMode;
152  $this->associates = $associates;
153  $this->approvalRuleMode = $approvalRuleMode;
154  $this->addresses = $addresses;
155  $this->shippingAddresses = $shippingAddresses;
156  $this->defaultShippingAddress = $defaultShippingAddress;
157  $this->billingAddresses = $billingAddresses;
158  $this->defaultBillingAddress = $defaultBillingAddress;
159  $this->custom = $custom;
160  $this->unitType = $unitType ?? self::DISCRIMINATOR_VALUE;
161  }
162 
169  public function getKey()
170  {
171  if (is_null($this->key)) {
173  $data = $this->raw(self::FIELD_KEY);
174  if (is_null($data)) {
175  return null;
176  }
177  $this->key = (string) $data;
178  }
179 
180  return $this->key;
181  }
182 
189  public function getStatus()
190  {
191  if (is_null($this->status)) {
193  $data = $this->raw(self::FIELD_STATUS);
194  if (is_null($data)) {
195  return null;
196  }
197  $this->status = (string) $data;
198  }
199 
200  return $this->status;
201  }
202 
212  public function getStores()
213  {
214  if (is_null($this->stores)) {
216  $data = $this->raw(self::FIELD_STORES);
217  if (is_null($data)) {
218  return null;
219  }
220  $this->stores = StoreResourceIdentifierCollection::fromArray($data);
221  }
222 
223  return $this->stores;
224  }
225 
233  public function getStoreMode()
234  {
235  if (is_null($this->storeMode)) {
237  $data = $this->raw(self::FIELD_STORE_MODE);
238  if (is_null($data)) {
239  return null;
240  }
241  $this->storeMode = (string) $data;
242  }
243 
244  return $this->storeMode;
245  }
246 
253  public function getUnitType()
254  {
255  if (is_null($this->unitType)) {
257  $data = $this->raw(self::FIELD_UNIT_TYPE);
258  if (is_null($data)) {
259  return null;
260  }
261  $this->unitType = (string) $data;
262  }
263 
264  return $this->unitType;
265  }
266 
273  public function getName()
274  {
275  if (is_null($this->name)) {
277  $data = $this->raw(self::FIELD_NAME);
278  if (is_null($data)) {
279  return null;
280  }
281  $this->name = (string) $data;
282  }
283 
284  return $this->name;
285  }
286 
293  public function getContactEmail()
294  {
295  if (is_null($this->contactEmail)) {
297  $data = $this->raw(self::FIELD_CONTACT_EMAIL);
298  if (is_null($data)) {
299  return null;
300  }
301  $this->contactEmail = (string) $data;
302  }
303 
304  return $this->contactEmail;
305  }
306 
314  public function getAssociateMode()
315  {
316  if (is_null($this->associateMode)) {
318  $data = $this->raw(self::FIELD_ASSOCIATE_MODE);
319  if (is_null($data)) {
320  return null;
321  }
322  $this->associateMode = (string) $data;
323  }
324 
325  return $this->associateMode;
326  }
327 
334  public function getAssociates()
335  {
336  if (is_null($this->associates)) {
338  $data = $this->raw(self::FIELD_ASSOCIATES);
339  if (is_null($data)) {
340  return null;
341  }
342  $this->associates = AssociateDraftCollection::fromArray($data);
343  }
344 
345  return $this->associates;
346  }
347 
356  public function getApprovalRuleMode()
357  {
358  if (is_null($this->approvalRuleMode)) {
360  $data = $this->raw(self::FIELD_APPROVAL_RULE_MODE);
361  if (is_null($data)) {
362  return null;
363  }
364  $this->approvalRuleMode = (string) $data;
365  }
366 
368  }
369 
376  public function getAddresses()
377  {
378  if (is_null($this->addresses)) {
380  $data = $this->raw(self::FIELD_ADDRESSES);
381  if (is_null($data)) {
382  return null;
383  }
384  $this->addresses = BaseAddressCollection::fromArray($data);
385  }
386 
387  return $this->addresses;
388  }
389 
397  public function getShippingAddresses()
398  {
399  if (is_null($this->shippingAddresses)) {
401  $data = $this->raw(self::FIELD_SHIPPING_ADDRESSES);
402  if (is_null($data)) {
403  return null;
404  }
405  $this->shippingAddresses = $data;
406  }
407 
409  }
410 
417  public function getDefaultShippingAddress()
418  {
419  if (is_null($this->defaultShippingAddress)) {
421  $data = $this->raw(self::FIELD_DEFAULT_SHIPPING_ADDRESS);
422  if (is_null($data)) {
423  return null;
424  }
425  $this->defaultShippingAddress = (int) $data;
426  }
427 
429  }
430 
438  public function getBillingAddresses()
439  {
440  if (is_null($this->billingAddresses)) {
442  $data = $this->raw(self::FIELD_BILLING_ADDRESSES);
443  if (is_null($data)) {
444  return null;
445  }
446  $this->billingAddresses = $data;
447  }
448 
450  }
451 
458  public function getDefaultBillingAddress()
459  {
460  if (is_null($this->defaultBillingAddress)) {
462  $data = $this->raw(self::FIELD_DEFAULT_BILLING_ADDRESS);
463  if (is_null($data)) {
464  return null;
465  }
466  $this->defaultBillingAddress = (int) $data;
467  }
468 
470  }
471 
478  public function getCustom()
479  {
480  if (is_null($this->custom)) {
482  $data = $this->raw(self::FIELD_CUSTOM);
483  if (is_null($data)) {
484  return null;
485  }
486 
487  $this->custom = CustomFieldsDraftModel::of($data);
488  }
489 
490  return $this->custom;
491  }
492 
493 
497  public function setKey(?string $key): void
498  {
499  $this->key = $key;
500  }
501 
505  public function setStatus(?string $status): void
506  {
507  $this->status = $status;
508  }
509 
514  {
515  $this->stores = $stores;
516  }
517 
521  public function setStoreMode(?string $storeMode): void
522  {
523  $this->storeMode = $storeMode;
524  }
525 
529  public function setName(?string $name): void
530  {
531  $this->name = $name;
532  }
533 
537  public function setContactEmail(?string $contactEmail): void
538  {
539  $this->contactEmail = $contactEmail;
540  }
541 
545  public function setAssociateMode(?string $associateMode): void
546  {
547  $this->associateMode = $associateMode;
548  }
549 
554  {
555  $this->associates = $associates;
556  }
557 
561  public function setApprovalRuleMode(?string $approvalRuleMode): void
562  {
563  $this->approvalRuleMode = $approvalRuleMode;
564  }
565 
570  {
571  $this->addresses = $addresses;
572  }
573 
577  public function setShippingAddresses(?array $shippingAddresses): void
578  {
579  $this->shippingAddresses = $shippingAddresses;
580  }
581 
586  {
587  $this->defaultShippingAddress = $defaultShippingAddress;
588  }
589 
593  public function setBillingAddresses(?array $billingAddresses): void
594  {
595  $this->billingAddresses = $billingAddresses;
596  }
597 
602  {
603  $this->defaultBillingAddress = $defaultBillingAddress;
604  }
605 
609  public function setCustom(?CustomFieldsDraft $custom): void
610  {
611  $this->custom = $custom;
612  }
613 }
__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)
setStores(?StoreResourceIdentifierCollection $stores)
setAssociates(?AssociateDraftCollection $associates)