commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
MyDivisionDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
20 use stdClass;
21 
26 {
27  public const DISCRIMINATOR_VALUE = 'Division';
32  protected $key;
33 
38  protected $unitType;
39 
44  protected $name;
45 
50  protected $contactEmail;
51 
56  protected $custom;
57 
62  protected $addresses;
63 
68  protected $shippingAddresses;
69 
75 
80  protected $billingAddresses;
81 
87 
92  protected $parentUnit;
93 
94 
98  public function __construct(
99  ?string $key = null,
100  ?string $name = null,
101  ?string $contactEmail = null,
102  ?CustomFieldsDraft $custom = null,
104  ?array $shippingAddresses = null,
105  ?int $defaultShippingAddress = null,
106  ?array $billingAddresses = null,
107  ?int $defaultBillingAddress = null,
109  ?string $unitType = null
110  ) {
111  $this->key = $key;
112  $this->name = $name;
113  $this->contactEmail = $contactEmail;
114  $this->custom = $custom;
115  $this->addresses = $addresses;
116  $this->shippingAddresses = $shippingAddresses;
117  $this->defaultShippingAddress = $defaultShippingAddress;
118  $this->billingAddresses = $billingAddresses;
119  $this->defaultBillingAddress = $defaultBillingAddress;
120  $this->parentUnit = $parentUnit;
121  $this->unitType = $unitType ?? self::DISCRIMINATOR_VALUE;
122  }
123 
130  public function getKey()
131  {
132  if (is_null($this->key)) {
134  $data = $this->raw(self::FIELD_KEY);
135  if (is_null($data)) {
136  return null;
137  }
138  $this->key = (string) $data;
139  }
140 
141  return $this->key;
142  }
143 
150  public function getUnitType()
151  {
152  if (is_null($this->unitType)) {
154  $data = $this->raw(self::FIELD_UNIT_TYPE);
155  if (is_null($data)) {
156  return null;
157  }
158  $this->unitType = (string) $data;
159  }
160 
161  return $this->unitType;
162  }
163 
170  public function getName()
171  {
172  if (is_null($this->name)) {
174  $data = $this->raw(self::FIELD_NAME);
175  if (is_null($data)) {
176  return null;
177  }
178  $this->name = (string) $data;
179  }
180 
181  return $this->name;
182  }
183 
190  public function getContactEmail()
191  {
192  if (is_null($this->contactEmail)) {
194  $data = $this->raw(self::FIELD_CONTACT_EMAIL);
195  if (is_null($data)) {
196  return null;
197  }
198  $this->contactEmail = (string) $data;
199  }
200 
201  return $this->contactEmail;
202  }
203 
210  public function getCustom()
211  {
212  if (is_null($this->custom)) {
214  $data = $this->raw(self::FIELD_CUSTOM);
215  if (is_null($data)) {
216  return null;
217  }
218 
219  $this->custom = CustomFieldsDraftModel::of($data);
220  }
221 
222  return $this->custom;
223  }
224 
231  public function getAddresses()
232  {
233  if (is_null($this->addresses)) {
235  $data = $this->raw(self::FIELD_ADDRESSES);
236  if (is_null($data)) {
237  return null;
238  }
239  $this->addresses = BaseAddressCollection::fromArray($data);
240  }
241 
242  return $this->addresses;
243  }
244 
252  public function getShippingAddresses()
253  {
254  if (is_null($this->shippingAddresses)) {
256  $data = $this->raw(self::FIELD_SHIPPING_ADDRESSES);
257  if (is_null($data)) {
258  return null;
259  }
260  $this->shippingAddresses = $data;
261  }
262 
264  }
265 
272  public function getDefaultShippingAddress()
273  {
274  if (is_null($this->defaultShippingAddress)) {
276  $data = $this->raw(self::FIELD_DEFAULT_SHIPPING_ADDRESS);
277  if (is_null($data)) {
278  return null;
279  }
280  $this->defaultShippingAddress = (int) $data;
281  }
282 
284  }
285 
293  public function getBillingAddresses()
294  {
295  if (is_null($this->billingAddresses)) {
297  $data = $this->raw(self::FIELD_BILLING_ADDRESSES);
298  if (is_null($data)) {
299  return null;
300  }
301  $this->billingAddresses = $data;
302  }
303 
305  }
306 
313  public function getDefaultBillingAddress()
314  {
315  if (is_null($this->defaultBillingAddress)) {
317  $data = $this->raw(self::FIELD_DEFAULT_BILLING_ADDRESS);
318  if (is_null($data)) {
319  return null;
320  }
321  $this->defaultBillingAddress = (int) $data;
322  }
323 
325  }
326 
333  public function getParentUnit()
334  {
335  if (is_null($this->parentUnit)) {
337  $data = $this->raw(self::FIELD_PARENT_UNIT);
338  if (is_null($data)) {
339  return null;
340  }
341 
342  $this->parentUnit = BusinessUnitResourceIdentifierModel::of($data);
343  }
344 
345  return $this->parentUnit;
346  }
347 
348 
352  public function setKey(?string $key): void
353  {
354  $this->key = $key;
355  }
356 
360  public function setName(?string $name): void
361  {
362  $this->name = $name;
363  }
364 
368  public function setContactEmail(?string $contactEmail): void
369  {
370  $this->contactEmail = $contactEmail;
371  }
372 
376  public function setCustom(?CustomFieldsDraft $custom): void
377  {
378  $this->custom = $custom;
379  }
380 
385  {
386  $this->addresses = $addresses;
387  }
388 
392  public function setShippingAddresses(?array $shippingAddresses): void
393  {
394  $this->shippingAddresses = $shippingAddresses;
395  }
396 
401  {
402  $this->defaultShippingAddress = $defaultShippingAddress;
403  }
404 
408  public function setBillingAddresses(?array $billingAddresses): void
409  {
410  $this->billingAddresses = $billingAddresses;
411  }
412 
417  {
418  $this->defaultBillingAddress = $defaultBillingAddress;
419  }
420 
425  {
426  $this->parentUnit = $parentUnit;
427  }
428 }
setParentUnit(?BusinessUnitResourceIdentifier $parentUnit)
__construct(?string $key=null, ?string $name=null, ?string $contactEmail=null, ?CustomFieldsDraft $custom=null, ?BaseAddressCollection $addresses=null, ?array $shippingAddresses=null, ?int $defaultShippingAddress=null, ?array $billingAddresses=null, ?int $defaultBillingAddress=null, ?BusinessUnitResourceIdentifier $parentUnit=null, ?string $unitType=null)