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
Product
ProductVariantDraftModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Product
;
10
11
use
Commercetools\Api\Models\Common\AssetDraftCollection
;
12
use
Commercetools\Api\Models\Common\ImageCollection
;
13
use
Commercetools\Api\Models\Common\PriceDraftCollection
;
14
use
Commercetools\Base\DateTimeImmutableCollection
;
15
use
Commercetools\Base\JsonObject
;
16
use
Commercetools\Base\JsonObjectModel
;
17
use
Commercetools\Base\MapperFactory
;
18
use stdClass;
19
23
final
class
ProductVariantDraftModel
extends
JsonObjectModel
implements
ProductVariantDraft
24
{
29
protected
$sku
;
30
35
protected
$key
;
36
41
protected
$prices
;
42
47
protected
$attributes
;
48
53
protected
$images
;
54
59
protected
$assets
;
60
61
65
public
function
__construct
(
66
?
string
$sku
=
null
,
67
?
string
$key
=
null
,
68
?
PriceDraftCollection
$prices
=
null
,
69
?
AttributeCollection
$attributes
=
null
,
70
?
ImageCollection
$images
=
null
,
71
?
AssetDraftCollection
$assets
=
null
72
) {
73
$this->sku =
$sku
;
74
$this->key =
$key
;
75
$this->prices =
$prices
;
76
$this->attributes =
$attributes
;
77
$this->images =
$images
;
78
$this->assets =
$assets
;
79
}
80
87
public
function
getSku
()
88
{
89
if
(is_null($this->sku)) {
91
$data = $this->
raw
(self::FIELD_SKU);
92
if
(is_null($data)) {
93
return
null
;
94
}
95
$this->sku = (string) $data;
96
}
97
98
return
$this->sku
;
99
}
100
107
public
function
getKey
()
108
{
109
if
(is_null($this->key)) {
111
$data = $this->
raw
(self::FIELD_KEY);
112
if
(is_null($data)) {
113
return
null
;
114
}
115
$this->key = (string) $data;
116
}
117
118
return
$this->key
;
119
}
120
128
public
function
getPrices
()
129
{
130
if
(is_null($this->prices)) {
132
$data = $this->
raw
(self::FIELD_PRICES);
133
if
(is_null($data)) {
134
return
null
;
135
}
136
$this->prices = PriceDraftCollection::fromArray($data);
137
}
138
139
return
$this->prices
;
140
}
141
148
public
function
getAttributes
()
149
{
150
if
(is_null($this->attributes)) {
152
$data = $this->
raw
(self::FIELD_ATTRIBUTES);
153
if
(is_null($data)) {
154
return
null
;
155
}
156
$this->attributes =
AttributeCollection::fromArray
($data);
157
}
158
159
return
$this->attributes
;
160
}
161
168
public
function
getImages
()
169
{
170
if
(is_null($this->images)) {
172
$data = $this->
raw
(self::FIELD_IMAGES);
173
if
(is_null($data)) {
174
return
null
;
175
}
176
$this->images = ImageCollection::fromArray($data);
177
}
178
179
return
$this->images
;
180
}
181
188
public
function
getAssets
()
189
{
190
if
(is_null($this->assets)) {
192
$data = $this->
raw
(self::FIELD_ASSETS);
193
if
(is_null($data)) {
194
return
null
;
195
}
196
$this->assets = AssetDraftCollection::fromArray($data);
197
}
198
199
return
$this->assets
;
200
}
201
202
206
public
function
setSku
(?
string
$sku
): void
207
{
208
$this->sku =
$sku
;
209
}
210
214
public
function
setKey
(?
string
$key
): void
215
{
216
$this->key =
$key
;
217
}
218
222
public
function
setPrices
(?
PriceDraftCollection
$prices
): void
223
{
224
$this->prices =
$prices
;
225
}
226
230
public
function
setAttributes
(?
AttributeCollection
$attributes
): void
231
{
232
$this->attributes =
$attributes
;
233
}
234
238
public
function
setImages
(?
ImageCollection
$images
): void
239
{
240
$this->images =
$images
;
241
}
242
246
public
function
setAssets
(?
AssetDraftCollection
$assets
): void
247
{
248
$this->assets =
$assets
;
249
}
250
}
Commercetools\Api\Models\Common\AssetDraftCollection
Definition
AssetDraftCollection.php:22
Commercetools\Api\Models\Common\ImageCollection
Definition
ImageCollection.php:22
Commercetools\Api\Models\Common\PriceDraftCollection
Definition
PriceDraftCollection.php:22
Commercetools\Api\Models\Product\AttributeCollection
Definition
AttributeCollection.php:22
Commercetools\Api\Models\Product\ProductVariantDraftModel
Definition
ProductVariantDraftModel.php:24
Commercetools\Api\Models\Product\ProductVariantDraftModel\__construct
__construct(?string $sku=null, ?string $key=null, ?PriceDraftCollection $prices=null, ?AttributeCollection $attributes=null, ?ImageCollection $images=null, ?AssetDraftCollection $assets=null)
Definition
ProductVariantDraftModel.php:65
Commercetools\Api\Models\Product\ProductVariantDraftModel\getAssets
getAssets()
Definition
ProductVariantDraftModel.php:188
Commercetools\Api\Models\Product\ProductVariantDraftModel\getPrices
getPrices()
Definition
ProductVariantDraftModel.php:128
Commercetools\Api\Models\Product\ProductVariantDraftModel\getAttributes
getAttributes()
Definition
ProductVariantDraftModel.php:148
Commercetools\Api\Models\Product\ProductVariantDraftModel\getImages
getImages()
Definition
ProductVariantDraftModel.php:168
Commercetools\Api\Models\Product\ProductVariantDraftModel\$assets
$assets
Definition
ProductVariantDraftModel.php:59
Commercetools\Api\Models\Product\ProductVariantDraftModel\$prices
$prices
Definition
ProductVariantDraftModel.php:41
Commercetools\Api\Models\Product\ProductVariantDraftModel\setPrices
setPrices(?PriceDraftCollection $prices)
Definition
ProductVariantDraftModel.php:222
Commercetools\Api\Models\Product\ProductVariantDraftModel\setAttributes
setAttributes(?AttributeCollection $attributes)
Definition
ProductVariantDraftModel.php:230
Commercetools\Api\Models\Product\ProductVariantDraftModel\setSku
setSku(?string $sku)
Definition
ProductVariantDraftModel.php:206
Commercetools\Api\Models\Product\ProductVariantDraftModel\getSku
getSku()
Definition
ProductVariantDraftModel.php:87
Commercetools\Api\Models\Product\ProductVariantDraftModel\$images
$images
Definition
ProductVariantDraftModel.php:53
Commercetools\Api\Models\Product\ProductVariantDraftModel\setAssets
setAssets(?AssetDraftCollection $assets)
Definition
ProductVariantDraftModel.php:246
Commercetools\Api\Models\Product\ProductVariantDraftModel\$attributes
$attributes
Definition
ProductVariantDraftModel.php:47
Commercetools\Api\Models\Product\ProductVariantDraftModel\$key
$key
Definition
ProductVariantDraftModel.php:35
Commercetools\Api\Models\Product\ProductVariantDraftModel\setImages
setImages(?ImageCollection $images)
Definition
ProductVariantDraftModel.php:238
Commercetools\Api\Models\Product\ProductVariantDraftModel\$sku
$sku
Definition
ProductVariantDraftModel.php:29
Commercetools\Api\Models\Product\ProductVariantDraftModel\getKey
getKey()
Definition
ProductVariantDraftModel.php:107
Commercetools\Api\Models\Product\ProductVariantDraftModel\setKey
setKey(?string $key)
Definition
ProductVariantDraftModel.php:214
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition
BaseJsonObject.php:57
Commercetools\Base\DateTimeImmutableCollection
Definition
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition
JsonObjectModel.php:15
Commercetools\Base\MapperFactory
Definition
MapperFactory.php:16
Commercetools\Api\Models\Product\ProductVariantDraft
Definition
ProductVariantDraft.php:18
Commercetools\Base\CSequence\fromArray
static fromArray(array $data)
Commercetools\Base\JsonObject
Definition
JsonObject.php:15
Commercetools\Api\Models\Product
Definition
AttributeAccessor.php:4
Generated by
1.9.8