commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
ProductDraftImportModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
28 use stdClass;
29 
34 {
39  protected $key;
40 
45  protected $productType;
46 
51  protected $name;
52 
57  protected $slug;
58 
63  protected $description;
64 
69  protected $categories;
70 
75  protected $metaTitle;
76 
81  protected $metaDescription;
82 
87  protected $metaKeywords;
88 
93  protected $masterVariant;
94 
99  protected $variants;
100 
105  protected $taxCategory;
106 
111  protected $searchKeywords;
112 
117  protected $state;
118 
123  protected $publish;
124 
129  protected $priceMode;
130 
131 
135  public function __construct(
136  ?string $key = null,
138  ?LocalizedString $name = null,
139  ?LocalizedString $slug = null,
142  ?LocalizedString $metaTitle = null,
149  ?StateKeyReference $state = null,
150  ?bool $publish = null,
151  ?string $priceMode = null
152  ) {
153  $this->key = $key;
154  $this->productType = $productType;
155  $this->name = $name;
156  $this->slug = $slug;
157  $this->description = $description;
158  $this->categories = $categories;
159  $this->metaTitle = $metaTitle;
160  $this->metaDescription = $metaDescription;
161  $this->metaKeywords = $metaKeywords;
162  $this->masterVariant = $masterVariant;
163  $this->variants = $variants;
164  $this->taxCategory = $taxCategory;
165  $this->searchKeywords = $searchKeywords;
166  $this->state = $state;
167  $this->publish = $publish;
168  $this->priceMode = $priceMode;
169  }
170 
177  public function getKey()
178  {
179  if (is_null($this->key)) {
181  $data = $this->raw(self::FIELD_KEY);
182  if (is_null($data)) {
183  return null;
184  }
185  $this->key = (string) $data;
186  }
187 
188  return $this->key;
189  }
190 
200  public function getProductType()
201  {
202  if (is_null($this->productType)) {
204  $data = $this->raw(self::FIELD_PRODUCT_TYPE);
205  if (is_null($data)) {
206  return null;
207  }
208 
209  $this->productType = ProductTypeKeyReferenceModel::of($data);
210  }
211 
212  return $this->productType;
213  }
214 
219  public function getName()
220  {
221  if (is_null($this->name)) {
223  $data = $this->raw(self::FIELD_NAME);
224  if (is_null($data)) {
225  return null;
226  }
227 
228  $this->name = LocalizedStringModel::of($data);
229  }
230 
231  return $this->name;
232  }
233 
241  public function getSlug()
242  {
243  if (is_null($this->slug)) {
245  $data = $this->raw(self::FIELD_SLUG);
246  if (is_null($data)) {
247  return null;
248  }
249 
250  $this->slug = LocalizedStringModel::of($data);
251  }
252 
253  return $this->slug;
254  }
255 
262  public function getDescription()
263  {
264  if (is_null($this->description)) {
266  $data = $this->raw(self::FIELD_DESCRIPTION);
267  if (is_null($data)) {
268  return null;
269  }
270 
271  $this->description = LocalizedStringModel::of($data);
272  }
273 
274  return $this->description;
275  }
276 
284  public function getCategories()
285  {
286  if (is_null($this->categories)) {
288  $data = $this->raw(self::FIELD_CATEGORIES);
289  if (is_null($data)) {
290  return null;
291  }
292  $this->categories = CategoryKeyReferenceCollection::fromArray($data);
293  }
294 
295  return $this->categories;
296  }
297 
309  public function getMetaTitle()
310  {
311  if (is_null($this->metaTitle)) {
313  $data = $this->raw(self::FIELD_META_TITLE);
314  if (is_null($data)) {
315  return null;
316  }
317 
318  $this->metaTitle = LocalizedStringModel::of($data);
319  }
320 
321  return $this->metaTitle;
322  }
323 
335  public function getMetaDescription()
336  {
337  if (is_null($this->metaDescription)) {
339  $data = $this->raw(self::FIELD_META_DESCRIPTION);
340  if (is_null($data)) {
341  return null;
342  }
343 
344  $this->metaDescription = LocalizedStringModel::of($data);
345  }
346 
347  return $this->metaDescription;
348  }
349 
361  public function getMetaKeywords()
362  {
363  if (is_null($this->metaKeywords)) {
365  $data = $this->raw(self::FIELD_META_KEYWORDS);
366  if (is_null($data)) {
367  return null;
368  }
369 
370  $this->metaKeywords = LocalizedStringModel::of($data);
371  }
372 
373  return $this->metaKeywords;
374  }
375 
383  public function getMasterVariant()
384  {
385  if (is_null($this->masterVariant)) {
387  $data = $this->raw(self::FIELD_MASTER_VARIANT);
388  if (is_null($data)) {
389  return null;
390  }
391 
392  $this->masterVariant = ProductVariantDraftImportModel::of($data);
393  }
394 
395  return $this->masterVariant;
396  }
397 
404  public function getVariants()
405  {
406  if (is_null($this->variants)) {
408  $data = $this->raw(self::FIELD_VARIANTS);
409  if (is_null($data)) {
410  return null;
411  }
412  $this->variants = ProductVariantDraftImportCollection::fromArray($data);
413  }
414 
415  return $this->variants;
416  }
417 
425  public function getTaxCategory()
426  {
427  if (is_null($this->taxCategory)) {
429  $data = $this->raw(self::FIELD_TAX_CATEGORY);
430  if (is_null($data)) {
431  return null;
432  }
433 
434  $this->taxCategory = TaxCategoryKeyReferenceModel::of($data);
435  }
436 
437  return $this->taxCategory;
438  }
439 
462  public function getSearchKeywords()
463  {
464  if (is_null($this->searchKeywords)) {
466  $data = $this->raw(self::FIELD_SEARCH_KEYWORDS);
467  if (is_null($data)) {
468  return null;
469  }
470 
471  $this->searchKeywords = SearchKeywordsModel::of($data);
472  }
473 
474  return $this->searchKeywords;
475  }
476 
484  public function getState()
485  {
486  if (is_null($this->state)) {
488  $data = $this->raw(self::FIELD_STATE);
489  if (is_null($data)) {
490  return null;
491  }
492 
493  $this->state = StateKeyReferenceModel::of($data);
494  }
495 
496  return $this->state;
497  }
498 
507  public function getPublish()
508  {
509  if (is_null($this->publish)) {
511  $data = $this->raw(self::FIELD_PUBLISH);
512  if (is_null($data)) {
513  return null;
514  }
515  $this->publish = (bool) $data;
516  }
517 
518  return $this->publish;
519  }
520 
527  public function getPriceMode()
528  {
529  if (is_null($this->priceMode)) {
531  $data = $this->raw(self::FIELD_PRICE_MODE);
532  if (is_null($data)) {
533  return null;
534  }
535  $this->priceMode = (string) $data;
536  }
537 
538  return $this->priceMode;
539  }
540 
541 
545  public function setKey(?string $key): void
546  {
547  $this->key = $key;
548  }
549 
554  {
555  $this->productType = $productType;
556  }
557 
561  public function setName(?LocalizedString $name): void
562  {
563  $this->name = $name;
564  }
565 
569  public function setSlug(?LocalizedString $slug): void
570  {
571  $this->slug = $slug;
572  }
573 
578  {
579  $this->description = $description;
580  }
581 
586  {
587  $this->categories = $categories;
588  }
589 
593  public function setMetaTitle(?LocalizedString $metaTitle): void
594  {
595  $this->metaTitle = $metaTitle;
596  }
597 
602  {
603  $this->metaDescription = $metaDescription;
604  }
605 
610  {
611  $this->metaKeywords = $metaKeywords;
612  }
613 
618  {
619  $this->masterVariant = $masterVariant;
620  }
621 
626  {
627  $this->variants = $variants;
628  }
629 
634  {
635  $this->taxCategory = $taxCategory;
636  }
637 
642  {
643  $this->searchKeywords = $searchKeywords;
644  }
645 
649  public function setState(?StateKeyReference $state): void
650  {
651  $this->state = $state;
652  }
653 
657  public function setPublish(?bool $publish): void
658  {
659  $this->publish = $publish;
660  }
661 
665  public function setPriceMode(?string $priceMode): void
666  {
667  $this->priceMode = $priceMode;
668  }
669 }
static of($data=null)
Definition: MapperMap.php:45
__construct(?string $key=null, ?ProductTypeKeyReference $productType=null, ?LocalizedString $name=null, ?LocalizedString $slug=null, ?LocalizedString $description=null, ?CategoryKeyReferenceCollection $categories=null, ?LocalizedString $metaTitle=null, ?LocalizedString $metaDescription=null, ?LocalizedString $metaKeywords=null, ?ProductVariantDraftImport $masterVariant=null, ?ProductVariantDraftImportCollection $variants=null, ?TaxCategoryKeyReference $taxCategory=null, ?SearchKeywords $searchKeywords=null, ?StateKeyReference $state=null, ?bool $publish=null, ?string $priceMode=null)