commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ProductImportModel.php
1<?php
2
3declare(strict_types=1);
10
27use stdClass;
28
32final class ProductImportModel extends JsonObjectModel implements ProductImport
33{
38 protected $key;
39
44 protected $name;
45
50 protected $productType;
51
56 protected $slug;
57
62 protected $description;
63
68 protected $categories;
69
74 protected $attributes;
75
80 protected $metaTitle;
81
87
92 protected $metaKeywords;
93
98 protected $taxCategory;
99
105
110 protected $state;
111
116 protected $publish;
117
122 protected $priceMode;
123
124
128 public function __construct(
129 ?string $key = null,
130 ?LocalizedString $name = null,
132 ?LocalizedString $slug = null,
142 ?bool $publish = null,
143 ?string $priceMode = null
144 ) {
145 $this->key = $key;
146 $this->name = $name;
147 $this->productType = $productType;
148 $this->slug = $slug;
149 $this->description = $description;
150 $this->categories = $categories;
151 $this->attributes = $attributes;
152 $this->metaTitle = $metaTitle;
153 $this->metaDescription = $metaDescription;
154 $this->metaKeywords = $metaKeywords;
155 $this->taxCategory = $taxCategory;
156 $this->searchKeywords = $searchKeywords;
157 $this->state = $state;
158 $this->publish = $publish;
159 $this->priceMode = $priceMode;
160 }
161
168 public function getKey()
169 {
170 if (is_null($this->key)) {
172 $data = $this->raw(self::FIELD_KEY);
173 if (is_null($data)) {
174 return null;
175 }
176 $this->key = (string) $data;
177 }
178
179 return $this->key;
180 }
181
188 public function getName()
189 {
190 if (is_null($this->name)) {
192 $data = $this->raw(self::FIELD_NAME);
193 if (is_null($data)) {
194 return null;
195 }
196
197 $this->name = LocalizedStringModel::of($data);
198 }
199
200 return $this->name;
201 }
202
209 public function getProductType()
210 {
211 if (is_null($this->productType)) {
213 $data = $this->raw(self::FIELD_PRODUCT_TYPE);
214 if (is_null($data)) {
215 return null;
216 }
217
218 $this->productType = ProductTypeKeyReferenceModel::of($data);
219 }
220
221 return $this->productType;
222 }
223
230 public function getSlug()
231 {
232 if (is_null($this->slug)) {
234 $data = $this->raw(self::FIELD_SLUG);
235 if (is_null($data)) {
236 return null;
237 }
238
239 $this->slug = LocalizedStringModel::of($data);
240 }
241
242 return $this->slug;
243 }
244
251 public function getDescription()
252 {
253 if (is_null($this->description)) {
255 $data = $this->raw(self::FIELD_DESCRIPTION);
256 if (is_null($data)) {
257 return null;
258 }
259
260 $this->description = LocalizedStringModel::of($data);
261 }
262
263 return $this->description;
264 }
265
272 public function getCategories()
273 {
274 if (is_null($this->categories)) {
276 $data = $this->raw(self::FIELD_CATEGORIES);
277 if (is_null($data)) {
278 return null;
279 }
280 $this->categories = CategoryKeyReferenceCollection::fromArray($data);
281 }
282
283 return $this->categories;
284 }
285
290 public function getAttributes()
291 {
292 if (is_null($this->attributes)) {
294 $data = $this->raw(self::FIELD_ATTRIBUTES);
295 if (is_null($data)) {
296 return null;
297 }
298 $this->attributes = AttributeCollection::fromArray($data);
299 }
300
301 return $this->attributes;
302 }
303
310 public function getMetaTitle()
311 {
312 if (is_null($this->metaTitle)) {
314 $data = $this->raw(self::FIELD_META_TITLE);
315 if (is_null($data)) {
316 return null;
317 }
318
319 $this->metaTitle = LocalizedStringModel::of($data);
320 }
321
322 return $this->metaTitle;
323 }
324
331 public function getMetaDescription()
332 {
333 if (is_null($this->metaDescription)) {
335 $data = $this->raw(self::FIELD_META_DESCRIPTION);
336 if (is_null($data)) {
337 return null;
338 }
339
340 $this->metaDescription = LocalizedStringModel::of($data);
341 }
342
344 }
345
352 public function getMetaKeywords()
353 {
354 if (is_null($this->metaKeywords)) {
356 $data = $this->raw(self::FIELD_META_KEYWORDS);
357 if (is_null($data)) {
358 return null;
359 }
360
361 $this->metaKeywords = LocalizedStringModel::of($data);
362 }
363
364 return $this->metaKeywords;
365 }
366
373 public function getTaxCategory()
374 {
375 if (is_null($this->taxCategory)) {
377 $data = $this->raw(self::FIELD_TAX_CATEGORY);
378 if (is_null($data)) {
379 return null;
380 }
381
382 $this->taxCategory = TaxCategoryKeyReferenceModel::of($data);
383 }
384
385 return $this->taxCategory;
386 }
387
394 public function getSearchKeywords()
395 {
396 if (is_null($this->searchKeywords)) {
398 $data = $this->raw(self::FIELD_SEARCH_KEYWORDS);
399 if (is_null($data)) {
400 return null;
401 }
402
403 $this->searchKeywords = SearchKeywordsModel::of($data);
404 }
405
407 }
408
415 public function getState()
416 {
417 if (is_null($this->state)) {
419 $data = $this->raw(self::FIELD_STATE);
420 if (is_null($data)) {
421 return null;
422 }
423
424 $this->state = StateKeyReferenceModel::of($data);
425 }
426
427 return $this->state;
428 }
429
436 public function getPublish()
437 {
438 if (is_null($this->publish)) {
440 $data = $this->raw(self::FIELD_PUBLISH);
441 if (is_null($data)) {
442 return null;
443 }
444 $this->publish = (bool) $data;
445 }
446
447 return $this->publish;
448 }
449
456 public function getPriceMode()
457 {
458 if (is_null($this->priceMode)) {
460 $data = $this->raw(self::FIELD_PRICE_MODE);
461 if (is_null($data)) {
462 return null;
463 }
464 $this->priceMode = (string) $data;
465 }
466
467 return $this->priceMode;
468 }
469
470
474 public function setKey(?string $key): void
475 {
476 $this->key = $key;
477 }
478
482 public function setName(?LocalizedString $name): void
483 {
484 $this->name = $name;
485 }
486
491 {
492 $this->productType = $productType;
493 }
494
498 public function setSlug(?LocalizedString $slug): void
499 {
500 $this->slug = $slug;
501 }
502
507 {
508 $this->description = $description;
509 }
510
515 {
516 $this->categories = $categories;
517 }
518
523 {
524 $this->attributes = $attributes;
525 }
526
531 {
532 $this->metaTitle = $metaTitle;
533 }
534
539 {
540 $this->metaDescription = $metaDescription;
541 }
542
547 {
548 $this->metaKeywords = $metaKeywords;
549 }
550
555 {
556 $this->taxCategory = $taxCategory;
557 }
558
563 {
564 $this->searchKeywords = $searchKeywords;
565 }
566
570 public function setState(?StateKeyReference $state): void
571 {
572 $this->state = $state;
573 }
574
578 public function setPublish(?bool $publish): void
579 {
580 $this->publish = $publish;
581 }
582
586 public function setPriceMode(?string $priceMode): void
587 {
588 $this->priceMode = $priceMode;
589 }
590}
setProductType(?ProductTypeKeyReference $productType)
setTaxCategory(?TaxCategoryKeyReference $taxCategory)
setCategories(?CategoryKeyReferenceCollection $categories)
__construct(?string $key=null, ?LocalizedString $name=null, ?ProductTypeKeyReference $productType=null, ?LocalizedString $slug=null, ?LocalizedString $description=null, ?CategoryKeyReferenceCollection $categories=null, ?AttributeCollection $attributes=null, ?LocalizedString $metaTitle=null, ?LocalizedString $metaDescription=null, ?LocalizedString $metaKeywords=null, ?TaxCategoryKeyReference $taxCategory=null, ?SearchKeywords $searchKeywords=null, ?StateKeyReference $state=null, ?bool $publish=null, ?string $priceMode=null)