commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
OrderAddDeliveryActionModel.php
1<?php
2
3declare(strict_types=1);
10
19use stdClass;
20
25{
26 public const DISCRIMINATOR_VALUE = 'addDelivery';
31 protected $action;
32
37 protected $deliveryKey;
38
43 protected $shippingKey;
44
49 protected $items;
50
55 protected $address;
56
61 protected $parcels;
62
67 protected $custom;
68
69
73 public function __construct(
74 ?string $deliveryKey = null,
75 ?string $shippingKey = null,
77 ?BaseAddress $address = null,
80 ?string $action = null
81 ) {
82 $this->deliveryKey = $deliveryKey;
83 $this->shippingKey = $shippingKey;
84 $this->items = $items;
85 $this->address = $address;
86 $this->parcels = $parcels;
87 $this->custom = $custom;
88 $this->action = $action ?? self::DISCRIMINATOR_VALUE;
89 }
90
95 public function getAction()
96 {
97 if (is_null($this->action)) {
99 $data = $this->raw(self::FIELD_ACTION);
100 if (is_null($data)) {
101 return null;
102 }
103 $this->action = (string) $data;
104 }
105
106 return $this->action;
107 }
108
115 public function getDeliveryKey()
116 {
117 if (is_null($this->deliveryKey)) {
119 $data = $this->raw(self::FIELD_DELIVERY_KEY);
120 if (is_null($data)) {
121 return null;
122 }
123 $this->deliveryKey = (string) $data;
124 }
125
126 return $this->deliveryKey;
127 }
128
135 public function getShippingKey()
136 {
137 if (is_null($this->shippingKey)) {
139 $data = $this->raw(self::FIELD_SHIPPING_KEY);
140 if (is_null($data)) {
141 return null;
142 }
143 $this->shippingKey = (string) $data;
144 }
145
146 return $this->shippingKey;
147 }
148
155 public function getItems()
156 {
157 if (is_null($this->items)) {
159 $data = $this->raw(self::FIELD_ITEMS);
160 if (is_null($data)) {
161 return null;
162 }
163 $this->items = DeliveryItemCollection::fromArray($data);
164 }
165
166 return $this->items;
167 }
168
175 public function getAddress()
176 {
177 if (is_null($this->address)) {
179 $data = $this->raw(self::FIELD_ADDRESS);
180 if (is_null($data)) {
181 return null;
182 }
183
184 $this->address = BaseAddressModel::of($data);
185 }
186
187 return $this->address;
188 }
189
197 public function getParcels()
198 {
199 if (is_null($this->parcels)) {
201 $data = $this->raw(self::FIELD_PARCELS);
202 if (is_null($data)) {
203 return null;
204 }
205 $this->parcels = ParcelDraftCollection::fromArray($data);
206 }
207
208 return $this->parcels;
209 }
210
217 public function getCustom()
218 {
219 if (is_null($this->custom)) {
221 $data = $this->raw(self::FIELD_CUSTOM);
222 if (is_null($data)) {
223 return null;
224 }
225
226 $this->custom = CustomFieldsDraftModel::of($data);
227 }
228
229 return $this->custom;
230 }
231
232
236 public function setDeliveryKey(?string $deliveryKey): void
237 {
238 $this->deliveryKey = $deliveryKey;
239 }
240
244 public function setShippingKey(?string $shippingKey): void
245 {
246 $this->shippingKey = $shippingKey;
247 }
248
252 public function setItems(?DeliveryItemCollection $items): void
253 {
254 $this->items = $items;
255 }
256
260 public function setAddress(?BaseAddress $address): void
261 {
262 $this->address = $address;
263 }
264
269 {
270 $this->parcels = $parcels;
271 }
272
276 public function setCustom(?CustomFieldsDraft $custom): void
277 {
278 $this->custom = $custom;
279 }
280}
__construct(?string $deliveryKey=null, ?string $shippingKey=null, ?DeliveryItemCollection $items=null, ?BaseAddress $address=null, ?ParcelDraftCollection $parcels=null, ?CustomFieldsDraft $custom=null, ?string $action=null)
static fromArray(array $data)