commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ProductDraftModel.php
1<?php
2
3declare(strict_types=1);
10
24use stdClass;
25
29final class ProductDraftModel extends JsonObjectModel implements ProductDraft
30{
35 protected $productType;
36
41 protected $name;
42
47 protected $slug;
48
53 protected $key;
54
59 protected $description;
60
65 protected $categories;
66
72
77 protected $metaTitle;
78
84
89 protected $metaKeywords;
90
95 protected $masterVariant;
96
101 protected $variants;
102
107 protected $taxCategory;
108
114
119 protected $state;
120
125 protected $publish;
126
131 protected $priceMode;
132
133
137 public function __construct(
139 ?LocalizedString $name = null,
140 ?LocalizedString $slug = null,
141 ?string $key = null,
153 ?bool $publish = null,
154 ?string $priceMode = null
155 ) {
156 $this->productType = $productType;
157 $this->name = $name;
158 $this->slug = $slug;
159 $this->key = $key;
160 $this->description = $description;
161 $this->categories = $categories;
162 $this->categoryOrderHints = $categoryOrderHints;
163 $this->metaTitle = $metaTitle;
164 $this->metaDescription = $metaDescription;
165 $this->metaKeywords = $metaKeywords;
166 $this->masterVariant = $masterVariant;
167 $this->variants = $variants;
168 $this->taxCategory = $taxCategory;
169 $this->searchKeywords = $searchKeywords;
170 $this->state = $state;
171 $this->publish = $publish;
172 $this->priceMode = $priceMode;
173 }
174
181 public function getProductType()
182 {
183 if (is_null($this->productType)) {
185 $data = $this->raw(self::FIELD_PRODUCT_TYPE);
186 if (is_null($data)) {
187 return null;
188 }
189
190 $this->productType = ProductTypeResourceIdentifierModel::of($data);
191 }
192
193 return $this->productType;
194 }
195
202 public function getName()
203 {
204 if (is_null($this->name)) {
206 $data = $this->raw(self::FIELD_NAME);
207 if (is_null($data)) {
208 return null;
209 }
210
211 $this->name = LocalizedStringModel::of($data);
212 }
213
214 return $this->name;
215 }
216
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
248 public function getKey()
249 {
250 if (is_null($this->key)) {
252 $data = $this->raw(self::FIELD_KEY);
253 if (is_null($data)) {
254 return null;
255 }
256 $this->key = (string) $data;
257 }
258
259 return $this->key;
260 }
261
268 public function getDescription()
269 {
270 if (is_null($this->description)) {
272 $data = $this->raw(self::FIELD_DESCRIPTION);
273 if (is_null($data)) {
274 return null;
275 }
276
277 $this->description = LocalizedStringModel::of($data);
278 }
279
280 return $this->description;
281 }
282
289 public function getCategories()
290 {
291 if (is_null($this->categories)) {
293 $data = $this->raw(self::FIELD_CATEGORIES);
294 if (is_null($data)) {
295 return null;
296 }
297 $this->categories = CategoryResourceIdentifierCollection::fromArray($data);
298 }
299
300 return $this->categories;
301 }
302
309 public function getCategoryOrderHints()
310 {
311 if (is_null($this->categoryOrderHints)) {
313 $data = $this->raw(self::FIELD_CATEGORY_ORDER_HINTS);
314 if (is_null($data)) {
315 return null;
316 }
317
318 $this->categoryOrderHints = CategoryOrderHintsModel::of($data);
319 }
320
322 }
323
330 public function getMetaTitle()
331 {
332 if (is_null($this->metaTitle)) {
334 $data = $this->raw(self::FIELD_META_TITLE);
335 if (is_null($data)) {
336 return null;
337 }
338
339 $this->metaTitle = LocalizedStringModel::of($data);
340 }
341
342 return $this->metaTitle;
343 }
344
351 public function getMetaDescription()
352 {
353 if (is_null($this->metaDescription)) {
355 $data = $this->raw(self::FIELD_META_DESCRIPTION);
356 if (is_null($data)) {
357 return null;
358 }
359
360 $this->metaDescription = LocalizedStringModel::of($data);
361 }
362
364 }
365
372 public function getMetaKeywords()
373 {
374 if (is_null($this->metaKeywords)) {
376 $data = $this->raw(self::FIELD_META_KEYWORDS);
377 if (is_null($data)) {
378 return null;
379 }
380
381 $this->metaKeywords = LocalizedStringModel::of($data);
382 }
383
384 return $this->metaKeywords;
385 }
386
393 public function getMasterVariant()
394 {
395 if (is_null($this->masterVariant)) {
397 $data = $this->raw(self::FIELD_MASTER_VARIANT);
398 if (is_null($data)) {
399 return null;
400 }
401
402 $this->masterVariant = ProductVariantDraftModel::of($data);
403 }
404
406 }
407
414 public function getVariants()
415 {
416 if (is_null($this->variants)) {
418 $data = $this->raw(self::FIELD_VARIANTS);
419 if (is_null($data)) {
420 return null;
421 }
422 $this->variants = ProductVariantDraftCollection::fromArray($data);
423 }
424
425 return $this->variants;
426 }
427
434 public function getTaxCategory()
435 {
436 if (is_null($this->taxCategory)) {
438 $data = $this->raw(self::FIELD_TAX_CATEGORY);
439 if (is_null($data)) {
440 return null;
441 }
442
443 $this->taxCategory = TaxCategoryResourceIdentifierModel::of($data);
444 }
445
446 return $this->taxCategory;
447 }
448
455 public function getSearchKeywords()
456 {
457 if (is_null($this->searchKeywords)) {
459 $data = $this->raw(self::FIELD_SEARCH_KEYWORDS);
460 if (is_null($data)) {
461 return null;
462 }
463
464 $this->searchKeywords = SearchKeywordsModel::of($data);
465 }
466
468 }
469
476 public function getState()
477 {
478 if (is_null($this->state)) {
480 $data = $this->raw(self::FIELD_STATE);
481 if (is_null($data)) {
482 return null;
483 }
484
485 $this->state = StateResourceIdentifierModel::of($data);
486 }
487
488 return $this->state;
489 }
490
497 public function getPublish()
498 {
499 if (is_null($this->publish)) {
501 $data = $this->raw(self::FIELD_PUBLISH);
502 if (is_null($data)) {
503 return null;
504 }
505 $this->publish = (bool) $data;
506 }
507
508 return $this->publish;
509 }
510
517 public function getPriceMode()
518 {
519 if (is_null($this->priceMode)) {
521 $data = $this->raw(self::FIELD_PRICE_MODE);
522 if (is_null($data)) {
523 return null;
524 }
525 $this->priceMode = (string) $data;
526 }
527
528 return $this->priceMode;
529 }
530
531
536 {
537 $this->productType = $productType;
538 }
539
543 public function setName(?LocalizedString $name): void
544 {
545 $this->name = $name;
546 }
547
551 public function setSlug(?LocalizedString $slug): void
552 {
553 $this->slug = $slug;
554 }
555
559 public function setKey(?string $key): void
560 {
561 $this->key = $key;
562 }
563
568 {
569 $this->description = $description;
570 }
571
576 {
577 $this->categories = $categories;
578 }
579
584 {
585 $this->categoryOrderHints = $categoryOrderHints;
586 }
587
592 {
593 $this->metaTitle = $metaTitle;
594 }
595
600 {
601 $this->metaDescription = $metaDescription;
602 }
603
608 {
609 $this->metaKeywords = $metaKeywords;
610 }
611
616 {
617 $this->masterVariant = $masterVariant;
618 }
619
624 {
625 $this->variants = $variants;
626 }
627
632 {
633 $this->taxCategory = $taxCategory;
634 }
635
640 {
641 $this->searchKeywords = $searchKeywords;
642 }
643
648 {
649 $this->state = $state;
650 }
651
655 public function setPublish(?bool $publish): void
656 {
657 $this->publish = $publish;
658 }
659
663 public function setPriceMode(?string $priceMode): void
664 {
665 $this->priceMode = $priceMode;
666 }
667}
setProductType(?ProductTypeResourceIdentifier $productType)
__construct(?ProductTypeResourceIdentifier $productType=null, ?LocalizedString $name=null, ?LocalizedString $slug=null, ?string $key=null, ?LocalizedString $description=null, ?CategoryResourceIdentifierCollection $categories=null, ?CategoryOrderHints $categoryOrderHints=null, ?LocalizedString $metaTitle=null, ?LocalizedString $metaDescription=null, ?LocalizedString $metaKeywords=null, ?ProductVariantDraft $masterVariant=null, ?ProductVariantDraftCollection $variants=null, ?TaxCategoryResourceIdentifier $taxCategory=null, ?SearchKeywords $searchKeywords=null, ?StateResourceIdentifier $state=null, ?bool $publish=null, ?string $priceMode=null)
setVariants(?ProductVariantDraftCollection $variants)
setMetaDescription(?LocalizedString $metaDescription)
setMasterVariant(?ProductVariantDraft $masterVariant)
setCategories(?CategoryResourceIdentifierCollection $categories)
setCategoryOrderHints(?CategoryOrderHints $categoryOrderHints)
setTaxCategory(?TaxCategoryResourceIdentifier $taxCategory)
static of($data=null)
static fromArray(array $data)