commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
VariantImportModel.php
1<?php
2
3declare(strict_types=1);
10
22use stdClass;
23
27final class VariantImportModel extends JsonObjectModel implements VariantImport
28{
33 protected $key;
34
39 protected $sku;
40
45 protected $product;
46
51 protected $publish;
52
57 protected $images;
58
63 protected $attributes;
64
69 protected $assets;
70
71
75 public function __construct(
76 ?string $key = null,
77 ?string $sku = null,
79 ?bool $publish = null,
83 ) {
84 $this->key = $key;
85 $this->sku = $sku;
86 $this->product = $product;
87 $this->publish = $publish;
88 $this->images = $images;
89 $this->attributes = $attributes;
90 $this->assets = $assets;
91 }
92
99 public function getKey()
100 {
101 if (is_null($this->key)) {
103 $data = $this->raw(self::FIELD_KEY);
104 if (is_null($data)) {
105 return null;
106 }
107 $this->key = (string) $data;
108 }
109
110 return $this->key;
111 }
112
119 public function getSku()
120 {
121 if (is_null($this->sku)) {
123 $data = $this->raw(self::FIELD_SKU);
124 if (is_null($data)) {
125 return null;
126 }
127 $this->sku = (string) $data;
128 }
129
130 return $this->sku;
131 }
132
139 public function getProduct()
140 {
141 if (is_null($this->product)) {
143 $data = $this->raw(self::FIELD_PRODUCT);
144 if (is_null($data)) {
145 return null;
146 }
147
148 $this->product = ProductKeyReferenceModel::of($data);
149 }
150
151 return $this->product;
152 }
153
161 public function getPublish()
162 {
163 if (is_null($this->publish)) {
165 $data = $this->raw(self::FIELD_PUBLISH);
166 if (is_null($data)) {
167 return null;
168 }
169 $this->publish = (bool) $data;
170 }
171
172 return $this->publish;
173 }
174
181 public function getImages()
182 {
183 if (is_null($this->images)) {
185 $data = $this->raw(self::FIELD_IMAGES);
186 if (is_null($data)) {
187 return null;
188 }
189 $this->images = ImageCollection::fromArray($data);
190 }
191
192 return $this->images;
193 }
194
201 public function getAttributes()
202 {
203 if (is_null($this->attributes)) {
205 $data = $this->raw(self::FIELD_ATTRIBUTES);
206 if (is_null($data)) {
207 return null;
208 }
209 $this->attributes = AttributeCollection::fromArray($data);
210 }
211
212 return $this->attributes;
213 }
214
221 public function getAssets()
222 {
223 if (is_null($this->assets)) {
225 $data = $this->raw(self::FIELD_ASSETS);
226 if (is_null($data)) {
227 return null;
228 }
229 $this->assets = AssetCollection::fromArray($data);
230 }
231
232 return $this->assets;
233 }
234
235
239 public function setKey(?string $key): void
240 {
241 $this->key = $key;
242 }
243
247 public function setSku(?string $sku): void
248 {
249 $this->sku = $sku;
250 }
251
256 {
257 $this->product = $product;
258 }
259
263 public function setPublish(?bool $publish): void
264 {
265 $this->publish = $publish;
266 }
267
271 public function setImages(?ImageCollection $images): void
272 {
273 $this->images = $images;
274 }
275
280 {
281 $this->attributes = $attributes;
282 }
283
287 public function setAssets(?AssetCollection $assets): void
288 {
289 $this->assets = $assets;
290 }
291}
__construct(?string $key=null, ?string $sku=null, ?ProductKeyReference $product=null, ?bool $publish=null, ?ImageCollection $images=null, ?AttributeCollection $attributes=null, ?AssetCollection $assets=null)