commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
ProductVariantImportModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
21 use stdClass;
22 
27 {
32  protected $key;
33 
38  protected $sku;
39 
44  protected $isMasterVariant;
45 
50  protected $attributes;
51 
56  protected $images;
57 
62  protected $assets;
63 
68  protected $publish;
69 
74  protected $product;
75 
76 
80  public function __construct(
81  ?string $key = null,
82  ?string $sku = null,
83  ?bool $isMasterVariant = null,
85  ?ImageCollection $images = null,
86  ?AssetCollection $assets = null,
87  ?bool $publish = null,
89  ) {
90  $this->key = $key;
91  $this->sku = $sku;
92  $this->isMasterVariant = $isMasterVariant;
93  $this->attributes = $attributes;
94  $this->images = $images;
95  $this->assets = $assets;
96  $this->publish = $publish;
97  $this->product = $product;
98  }
99 
106  public function getKey()
107  {
108  if (is_null($this->key)) {
110  $data = $this->raw(self::FIELD_KEY);
111  if (is_null($data)) {
112  return null;
113  }
114  $this->key = (string) $data;
115  }
116 
117  return $this->key;
118  }
119 
126  public function getSku()
127  {
128  if (is_null($this->sku)) {
130  $data = $this->raw(self::FIELD_SKU);
131  if (is_null($data)) {
132  return null;
133  }
134  $this->sku = (string) $data;
135  }
136 
137  return $this->sku;
138  }
139 
146  public function getIsMasterVariant()
147  {
148  if (is_null($this->isMasterVariant)) {
150  $data = $this->raw(self::FIELD_IS_MASTER_VARIANT);
151  if (is_null($data)) {
152  return null;
153  }
154  $this->isMasterVariant = (bool) $data;
155  }
156 
157  return $this->isMasterVariant;
158  }
159 
167  public function getAttributes()
168  {
169  if (is_null($this->attributes)) {
171  $data = $this->raw(self::FIELD_ATTRIBUTES);
172  if (is_null($data)) {
173  return null;
174  }
175  $this->attributes = AttributeCollection::fromArray($data);
176  }
177 
178  return $this->attributes;
179  }
180 
187  public function getImages()
188  {
189  if (is_null($this->images)) {
191  $data = $this->raw(self::FIELD_IMAGES);
192  if (is_null($data)) {
193  return null;
194  }
195  $this->images = ImageCollection::fromArray($data);
196  }
197 
198  return $this->images;
199  }
200 
207  public function getAssets()
208  {
209  if (is_null($this->assets)) {
211  $data = $this->raw(self::FIELD_ASSETS);
212  if (is_null($data)) {
213  return null;
214  }
215  $this->assets = AssetCollection::fromArray($data);
216  }
217 
218  return $this->assets;
219  }
220 
229  public function getPublish()
230  {
231  if (is_null($this->publish)) {
233  $data = $this->raw(self::FIELD_PUBLISH);
234  if (is_null($data)) {
235  return null;
236  }
237  $this->publish = (bool) $data;
238  }
239 
240  return $this->publish;
241  }
242 
251  public function getProduct()
252  {
253  if (is_null($this->product)) {
255  $data = $this->raw(self::FIELD_PRODUCT);
256  if (is_null($data)) {
257  return null;
258  }
259 
260  $this->product = ProductKeyReferenceModel::of($data);
261  }
262 
263  return $this->product;
264  }
265 
266 
270  public function setKey(?string $key): void
271  {
272  $this->key = $key;
273  }
274 
278  public function setSku(?string $sku): void
279  {
280  $this->sku = $sku;
281  }
282 
286  public function setIsMasterVariant(?bool $isMasterVariant): void
287  {
288  $this->isMasterVariant = $isMasterVariant;
289  }
290 
295  {
296  $this->attributes = $attributes;
297  }
298 
302  public function setImages(?ImageCollection $images): void
303  {
304  $this->images = $images;
305  }
306 
310  public function setAssets(?AssetCollection $assets): void
311  {
312  $this->assets = $assets;
313  }
314 
318  public function setPublish(?bool $publish): void
319  {
320  $this->publish = $publish;
321  }
322 
326  public function setProduct(?ProductKeyReference $product): void
327  {
328  $this->product = $product;
329  }
330 }
__construct(?string $key=null, ?string $sku=null, ?bool $isMasterVariant=null, ?AttributeCollection $attributes=null, ?ImageCollection $images=null, ?AssetCollection $assets=null, ?bool $publish=null, ?ProductKeyReference $product=null)