commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
lib
commercetools-api
src
Models
Order
ParcelDraftModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Order
;
10
11
use
Commercetools\Api\Models\Type\CustomFieldsDraft
;
12
use
Commercetools\Api\Models\Type\CustomFieldsDraftModel
;
13
use
Commercetools\Base\DateTimeImmutableCollection
;
14
use
Commercetools\Base\JsonObject
;
15
use
Commercetools\Base\JsonObjectModel
;
16
use
Commercetools\Base\MapperFactory
;
17
use stdClass;
18
22
final
class
ParcelDraftModel
extends
JsonObjectModel
implements
ParcelDraft
23
{
28
protected
$key
;
29
34
protected
$measurements
;
35
40
protected
$trackingData
;
41
46
protected
$items
;
47
52
protected
$custom
;
53
54
58
public
function
__construct
(
59
?
string
$key
=
null
,
60
?
ParcelMeasurements
$measurements
=
null
,
61
?
TrackingData
$trackingData
=
null
,
62
?
DeliveryItemCollection
$items
=
null
,
63
?
CustomFieldsDraft
$custom
=
null
64
) {
65
$this->key =
$key
;
66
$this->measurements =
$measurements
;
67
$this->trackingData =
$trackingData
;
68
$this->items =
$items
;
69
$this->custom =
$custom
;
70
}
71
78
public
function
getKey
()
79
{
80
if
(is_null($this->key)) {
82
$data = $this->
raw
(self::FIELD_KEY);
83
if
(is_null($data)) {
84
return
null
;
85
}
86
$this->key = (string) $data;
87
}
88
89
return
$this->key
;
90
}
91
98
public
function
getMeasurements
()
99
{
100
if
(is_null($this->measurements)) {
102
$data = $this->
raw
(self::FIELD_MEASUREMENTS);
103
if
(is_null($data)) {
104
return
null
;
105
}
106
107
$this->measurements =
ParcelMeasurementsModel::of
($data);
108
}
109
110
return
$this->measurements
;
111
}
112
119
public
function
getTrackingData
()
120
{
121
if
(is_null($this->trackingData)) {
123
$data = $this->
raw
(self::FIELD_TRACKING_DATA);
124
if
(is_null($data)) {
125
return
null
;
126
}
127
128
$this->trackingData =
TrackingDataModel::of
($data);
129
}
130
131
return
$this->trackingData
;
132
}
133
140
public
function
getItems
()
141
{
142
if
(is_null($this->items)) {
144
$data = $this->
raw
(self::FIELD_ITEMS);
145
if
(is_null($data)) {
146
return
null
;
147
}
148
$this->items =
DeliveryItemCollection::fromArray
($data);
149
}
150
151
return
$this->items
;
152
}
153
160
public
function
getCustom
()
161
{
162
if
(is_null($this->custom)) {
164
$data = $this->
raw
(self::FIELD_CUSTOM);
165
if
(is_null($data)) {
166
return
null
;
167
}
168
169
$this->custom = CustomFieldsDraftModel::of($data);
170
}
171
172
return
$this->custom
;
173
}
174
175
179
public
function
setKey
(?
string
$key
): void
180
{
181
$this->key =
$key
;
182
}
183
187
public
function
setMeasurements
(?
ParcelMeasurements
$measurements
): void
188
{
189
$this->measurements =
$measurements
;
190
}
191
195
public
function
setTrackingData
(?
TrackingData
$trackingData
): void
196
{
197
$this->trackingData =
$trackingData
;
198
}
199
203
public
function
setItems
(?
DeliveryItemCollection
$items
): void
204
{
205
$this->items =
$items
;
206
}
207
211
public
function
setCustom
(?
CustomFieldsDraft
$custom
): void
212
{
213
$this->custom =
$custom
;
214
}
215
}
Commercetools\Api\Models\Order\DeliveryItemCollection
Definition
DeliveryItemCollection.php:22
Commercetools\Api\Models\Order\ParcelDraftModel
Definition
ParcelDraftModel.php:23
Commercetools\Api\Models\Order\ParcelDraftModel\$items
$items
Definition
ParcelDraftModel.php:46
Commercetools\Api\Models\Order\ParcelDraftModel\$measurements
$measurements
Definition
ParcelDraftModel.php:34
Commercetools\Api\Models\Order\ParcelDraftModel\setTrackingData
setTrackingData(?TrackingData $trackingData)
Definition
ParcelDraftModel.php:195
Commercetools\Api\Models\Order\ParcelDraftModel\$key
$key
Definition
ParcelDraftModel.php:28
Commercetools\Api\Models\Order\ParcelDraftModel\$trackingData
$trackingData
Definition
ParcelDraftModel.php:40
Commercetools\Api\Models\Order\ParcelDraftModel\getItems
getItems()
Definition
ParcelDraftModel.php:140
Commercetools\Api\Models\Order\ParcelDraftModel\getTrackingData
getTrackingData()
Definition
ParcelDraftModel.php:119
Commercetools\Api\Models\Order\ParcelDraftModel\setCustom
setCustom(?CustomFieldsDraft $custom)
Definition
ParcelDraftModel.php:211
Commercetools\Api\Models\Order\ParcelDraftModel\setKey
setKey(?string $key)
Definition
ParcelDraftModel.php:179
Commercetools\Api\Models\Order\ParcelDraftModel\getKey
getKey()
Definition
ParcelDraftModel.php:78
Commercetools\Api\Models\Order\ParcelDraftModel\setItems
setItems(?DeliveryItemCollection $items)
Definition
ParcelDraftModel.php:203
Commercetools\Api\Models\Order\ParcelDraftModel\__construct
__construct(?string $key=null, ?ParcelMeasurements $measurements=null, ?TrackingData $trackingData=null, ?DeliveryItemCollection $items=null, ?CustomFieldsDraft $custom=null)
Definition
ParcelDraftModel.php:58
Commercetools\Api\Models\Order\ParcelDraftModel\$custom
$custom
Definition
ParcelDraftModel.php:52
Commercetools\Api\Models\Order\ParcelDraftModel\getMeasurements
getMeasurements()
Definition
ParcelDraftModel.php:98
Commercetools\Api\Models\Order\ParcelDraftModel\setMeasurements
setMeasurements(?ParcelMeasurements $measurements)
Definition
ParcelDraftModel.php:187
Commercetools\Api\Models\Order\ParcelDraftModel\getCustom
getCustom()
Definition
ParcelDraftModel.php:160
Commercetools\Api\Models\Type\CustomFieldsDraftModel
Definition
CustomFieldsDraftModel.php:21
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition
BaseJsonObject.php:57
Commercetools\Base\BaseJsonObject\of
static of($data=null)
Definition
BaseJsonObject.php:26
Commercetools\Base\DateTimeImmutableCollection
Definition
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition
JsonObjectModel.php:15
Commercetools\Base\MapperFactory
Definition
MapperFactory.php:16
Commercetools\Api\Models\Order\ParcelDraft
Definition
ParcelDraft.php:16
Commercetools\Api\Models\Order\ParcelMeasurements
Definition
ParcelMeasurements.php:15
Commercetools\Api\Models\Order\TrackingData
Definition
TrackingData.php:15
Commercetools\Api\Models\Type\CustomFieldsDraft
Definition
CustomFieldsDraft.php:15
Commercetools\Base\CSequence\fromArray
static fromArray(array $data)
Commercetools\Base\JsonObject
Definition
JsonObject.php:15
Commercetools\Api\Models\Order
Definition
CustomLineItemImportDraft.php:9
Generated by
1.9.8