commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
LineItemProductVariantImportDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
19 use stdClass;
20 
25 {
30  protected $productVariant;
31 
36  protected $sku;
37 
42  protected $prices;
43 
48  protected $attributes;
49 
54  protected $images;
55 
56 
60  public function __construct(
62  ?string $sku = null,
65  ?ImageCollection $images = null
66  ) {
67  $this->productVariant = $productVariant;
68  $this->sku = $sku;
69  $this->prices = $prices;
70  $this->attributes = $attributes;
71  $this->images = $images;
72  }
73 
80  public function getProductVariant()
81  {
82  if (is_null($this->productVariant)) {
84  $data = $this->raw(self::FIELD_PRODUCT_VARIANT);
85  if (is_null($data)) {
86  return null;
87  }
88 
89  $this->productVariant = ProductVariantKeyReferenceModel::of($data);
90  }
91 
92  return $this->productVariant;
93  }
94 
101  public function getSku()
102  {
103  if (is_null($this->sku)) {
105  $data = $this->raw(self::FIELD_SKU);
106  if (is_null($data)) {
107  return null;
108  }
109  $this->sku = (string) $data;
110  }
111 
112  return $this->sku;
113  }
114 
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 = LineItemPriceCollection::fromArray($data);
130  }
131 
132  return $this->prices;
133  }
134 
141  public function getAttributes()
142  {
143  if (is_null($this->attributes)) {
145  $data = $this->raw(self::FIELD_ATTRIBUTES);
146  if (is_null($data)) {
147  return null;
148  }
149  $this->attributes = AttributeCollection::fromArray($data);
150  }
151 
152  return $this->attributes;
153  }
154 
161  public function getImages()
162  {
163  if (is_null($this->images)) {
165  $data = $this->raw(self::FIELD_IMAGES);
166  if (is_null($data)) {
167  return null;
168  }
169  $this->images = ImageCollection::fromArray($data);
170  }
171 
172  return $this->images;
173  }
174 
175 
180  {
181  $this->productVariant = $productVariant;
182  }
183 
187  public function setSku(?string $sku): void
188  {
189  $this->sku = $sku;
190  }
191 
195  public function setPrices(?LineItemPriceCollection $prices): void
196  {
197  $this->prices = $prices;
198  }
199 
204  {
205  $this->attributes = $attributes;
206  }
207 
211  public function setImages(?ImageCollection $images): void
212  {
213  $this->images = $images;
214  }
215 }
__construct(?ProductVariantKeyReference $productVariant=null, ?string $sku=null, ?LineItemPriceCollection $prices=null, ?AttributeCollection $attributes=null, ?ImageCollection $images=null)