commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
ProductVariantDraftImportModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
18 use stdClass;
19 
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,
70  ?ImageCollection $images = null,
71  ?AssetCollection $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 
85  public function getSku()
86  {
87  if (is_null($this->sku)) {
89  $data = $this->raw(self::FIELD_SKU);
90  if (is_null($data)) {
91  return null;
92  }
93  $this->sku = (string) $data;
94  }
95 
96  return $this->sku;
97  }
98 
103  public function getKey()
104  {
105  if (is_null($this->key)) {
107  $data = $this->raw(self::FIELD_KEY);
108  if (is_null($data)) {
109  return null;
110  }
111  $this->key = (string) $data;
112  }
113 
114  return $this->key;
115  }
116 
121  public function getPrices()
122  {
123  if (is_null($this->prices)) {
125  $data = $this->raw(self::FIELD_PRICES);
126  if (is_null($data)) {
127  return null;
128  }
129  $this->prices = PriceDraftImportCollection::fromArray($data);
130  }
131 
132  return $this->prices;
133  }
134 
139  public function getAttributes()
140  {
141  if (is_null($this->attributes)) {
143  $data = $this->raw(self::FIELD_ATTRIBUTES);
144  if (is_null($data)) {
145  return null;
146  }
147  $this->attributes = AttributeCollection::fromArray($data);
148  }
149 
150  return $this->attributes;
151  }
152 
157  public function getImages()
158  {
159  if (is_null($this->images)) {
161  $data = $this->raw(self::FIELD_IMAGES);
162  if (is_null($data)) {
163  return null;
164  }
165  $this->images = ImageCollection::fromArray($data);
166  }
167 
168  return $this->images;
169  }
170 
175  public function getAssets()
176  {
177  if (is_null($this->assets)) {
179  $data = $this->raw(self::FIELD_ASSETS);
180  if (is_null($data)) {
181  return null;
182  }
183  $this->assets = AssetCollection::fromArray($data);
184  }
185 
186  return $this->assets;
187  }
188 
189 
193  public function setSku(?string $sku): void
194  {
195  $this->sku = $sku;
196  }
197 
201  public function setKey(?string $key): void
202  {
203  $this->key = $key;
204  }
205 
210  {
211  $this->prices = $prices;
212  }
213 
218  {
219  $this->attributes = $attributes;
220  }
221 
225  public function setImages(?ImageCollection $images): void
226  {
227  $this->images = $images;
228  }
229 
233  public function setAssets(?AssetCollection $assets): void
234  {
235  $this->assets = $assets;
236  }
237 }
__construct(?string $sku=null, ?string $key=null, ?PriceDraftImportCollection $prices=null, ?AttributeCollection $attributes=null, ?ImageCollection $images=null, ?AssetCollection $assets=null)