commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
ProductImportModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
26 use stdClass;
27 
31 final class ProductImportModel extends JsonObjectModel implements ProductImport
32 {
37  protected $key;
38 
43  protected $name;
44 
49  protected $productType;
50 
55  protected $slug;
56 
61  protected $description;
62 
67  protected $categories;
68 
73  protected $metaTitle;
74 
79  protected $metaDescription;
80 
85  protected $metaKeywords;
86 
91  protected $taxCategory;
92 
97  protected $searchKeywords;
98 
103  protected $state;
104 
109  protected $publish;
110 
115  protected $priceMode;
116 
117 
121  public function __construct(
122  ?string $key = null,
123  ?LocalizedString $name = null,
125  ?LocalizedString $slug = null,
128  ?LocalizedString $metaTitle = null,
133  ?StateKeyReference $state = null,
134  ?bool $publish = null,
135  ?string $priceMode = null
136  ) {
137  $this->key = $key;
138  $this->name = $name;
139  $this->productType = $productType;
140  $this->slug = $slug;
141  $this->description = $description;
142  $this->categories = $categories;
143  $this->metaTitle = $metaTitle;
144  $this->metaDescription = $metaDescription;
145  $this->metaKeywords = $metaKeywords;
146  $this->taxCategory = $taxCategory;
147  $this->searchKeywords = $searchKeywords;
148  $this->state = $state;
149  $this->publish = $publish;
150  $this->priceMode = $priceMode;
151  }
152 
159  public function getKey()
160  {
161  if (is_null($this->key)) {
163  $data = $this->raw(self::FIELD_KEY);
164  if (is_null($data)) {
165  return null;
166  }
167  $this->key = (string) $data;
168  }
169 
170  return $this->key;
171  }
172 
179  public function getName()
180  {
181  if (is_null($this->name)) {
183  $data = $this->raw(self::FIELD_NAME);
184  if (is_null($data)) {
185  return null;
186  }
187 
188  $this->name = LocalizedStringModel::of($data);
189  }
190 
191  return $this->name;
192  }
193 
203  public function getProductType()
204  {
205  if (is_null($this->productType)) {
207  $data = $this->raw(self::FIELD_PRODUCT_TYPE);
208  if (is_null($data)) {
209  return null;
210  }
211 
212  $this->productType = ProductTypeKeyReferenceModel::of($data);
213  }
214 
215  return $this->productType;
216  }
217 
225  public function getSlug()
226  {
227  if (is_null($this->slug)) {
229  $data = $this->raw(self::FIELD_SLUG);
230  if (is_null($data)) {
231  return null;
232  }
233 
234  $this->slug = LocalizedStringModel::of($data);
235  }
236 
237  return $this->slug;
238  }
239 
246  public function getDescription()
247  {
248  if (is_null($this->description)) {
250  $data = $this->raw(self::FIELD_DESCRIPTION);
251  if (is_null($data)) {
252  return null;
253  }
254 
255  $this->description = LocalizedStringModel::of($data);
256  }
257 
258  return $this->description;
259  }
260 
269  public function getCategories()
270  {
271  if (is_null($this->categories)) {
273  $data = $this->raw(self::FIELD_CATEGORIES);
274  if (is_null($data)) {
275  return null;
276  }
277  $this->categories = CategoryKeyReferenceCollection::fromArray($data);
278  }
279 
280  return $this->categories;
281  }
282 
294  public function getMetaTitle()
295  {
296  if (is_null($this->metaTitle)) {
298  $data = $this->raw(self::FIELD_META_TITLE);
299  if (is_null($data)) {
300  return null;
301  }
302 
303  $this->metaTitle = LocalizedStringModel::of($data);
304  }
305 
306  return $this->metaTitle;
307  }
308 
320  public function getMetaDescription()
321  {
322  if (is_null($this->metaDescription)) {
324  $data = $this->raw(self::FIELD_META_DESCRIPTION);
325  if (is_null($data)) {
326  return null;
327  }
328 
329  $this->metaDescription = LocalizedStringModel::of($data);
330  }
331 
332  return $this->metaDescription;
333  }
334 
346  public function getMetaKeywords()
347  {
348  if (is_null($this->metaKeywords)) {
350  $data = $this->raw(self::FIELD_META_KEYWORDS);
351  if (is_null($data)) {
352  return null;
353  }
354 
355  $this->metaKeywords = LocalizedStringModel::of($data);
356  }
357 
358  return $this->metaKeywords;
359  }
360 
368  public function getTaxCategory()
369  {
370  if (is_null($this->taxCategory)) {
372  $data = $this->raw(self::FIELD_TAX_CATEGORY);
373  if (is_null($data)) {
374  return null;
375  }
376 
377  $this->taxCategory = TaxCategoryKeyReferenceModel::of($data);
378  }
379 
380  return $this->taxCategory;
381  }
382 
405  public function getSearchKeywords()
406  {
407  if (is_null($this->searchKeywords)) {
409  $data = $this->raw(self::FIELD_SEARCH_KEYWORDS);
410  if (is_null($data)) {
411  return null;
412  }
413 
414  $this->searchKeywords = SearchKeywordsModel::of($data);
415  }
416 
417  return $this->searchKeywords;
418  }
419 
427  public function getState()
428  {
429  if (is_null($this->state)) {
431  $data = $this->raw(self::FIELD_STATE);
432  if (is_null($data)) {
433  return null;
434  }
435 
436  $this->state = StateKeyReferenceModel::of($data);
437  }
438 
439  return $this->state;
440  }
441 
450  public function getPublish()
451  {
452  if (is_null($this->publish)) {
454  $data = $this->raw(self::FIELD_PUBLISH);
455  if (is_null($data)) {
456  return null;
457  }
458  $this->publish = (bool) $data;
459  }
460 
461  return $this->publish;
462  }
463 
470  public function getPriceMode()
471  {
472  if (is_null($this->priceMode)) {
474  $data = $this->raw(self::FIELD_PRICE_MODE);
475  if (is_null($data)) {
476  return null;
477  }
478  $this->priceMode = (string) $data;
479  }
480 
481  return $this->priceMode;
482  }
483 
484 
488  public function setKey(?string $key): void
489  {
490  $this->key = $key;
491  }
492 
496  public function setName(?LocalizedString $name): void
497  {
498  $this->name = $name;
499  }
500 
505  {
506  $this->productType = $productType;
507  }
508 
512  public function setSlug(?LocalizedString $slug): void
513  {
514  $this->slug = $slug;
515  }
516 
521  {
522  $this->description = $description;
523  }
524 
529  {
530  $this->categories = $categories;
531  }
532 
536  public function setMetaTitle(?LocalizedString $metaTitle): void
537  {
538  $this->metaTitle = $metaTitle;
539  }
540 
545  {
546  $this->metaDescription = $metaDescription;
547  }
548 
553  {
554  $this->metaKeywords = $metaKeywords;
555  }
556 
561  {
562  $this->taxCategory = $taxCategory;
563  }
564 
569  {
570  $this->searchKeywords = $searchKeywords;
571  }
572 
576  public function setState(?StateKeyReference $state): void
577  {
578  $this->state = $state;
579  }
580 
584  public function setPublish(?bool $publish): void
585  {
586  $this->publish = $publish;
587  }
588 
592  public function setPriceMode(?string $priceMode): void
593  {
594  $this->priceMode = $priceMode;
595  }
596 }
static of($data=null)
Definition: MapperMap.php:45
setProductType(?ProductTypeKeyReference $productType)
setTaxCategory(?TaxCategoryKeyReference $taxCategory)
__construct(?string $key=null, ?LocalizedString $name=null, ?ProductTypeKeyReference $productType=null, ?LocalizedString $slug=null, ?LocalizedString $description=null, ?CategoryKeyReferenceCollection $categories=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)
setCategories(?CategoryKeyReferenceCollection $categories)