commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ProductProjectionBuilder.php
1<?php
2
3declare(strict_types=1);
10
29use DateTimeImmutable;
30use stdClass;
31
35final class ProductProjectionBuilder implements Builder
36{
41 private $id;
42
47 private $version;
48
53 private $createdAt;
54
59 private $lastModifiedAt;
60
65 private $key;
66
71 private $productType;
72
77 private $name;
78
83 private $description;
84
89 private $slug;
90
95 private $categories;
96
101 private $categoryOrderHints;
102
107 private $metaTitle;
108
113 private $metaDescription;
114
119 private $metaKeywords;
120
125 private $searchKeywords;
126
131 private $hasStagedChanges;
132
137 private $published;
138
143 private $masterVariant;
144
149 private $variants;
150
155 private $taxCategory;
156
161 private $state;
162
167 private $reviewRatingStatistics;
168
173 private $priceMode;
174
179 private $attributes;
180
187 public function getId()
188 {
189 return $this->id;
190 }
191
198 public function getVersion()
199 {
200 return $this->version;
201 }
202
209 public function getCreatedAt()
210 {
211 return $this->createdAt;
212 }
213
220 public function getLastModifiedAt()
221 {
222 return $this->lastModifiedAt;
223 }
224
231 public function getKey()
232 {
233 return $this->key;
234 }
235
242 public function getProductType()
243 {
244 return $this->productType instanceof ProductTypeReferenceBuilder ? $this->productType->build() : $this->productType;
245 }
246
253 public function getName()
254 {
255 return $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name;
256 }
257
264 public function getDescription()
265 {
266 return $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description;
267 }
268
278 public function getSlug()
279 {
280 return $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug;
281 }
282
289 public function getCategories()
290 {
291 return $this->categories;
292 }
293
300 public function getCategoryOrderHints()
301 {
302 return $this->categoryOrderHints instanceof CategoryOrderHintsBuilder ? $this->categoryOrderHints->build() : $this->categoryOrderHints;
303 }
304
311 public function getMetaTitle()
312 {
313 return $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle;
314 }
315
322 public function getMetaDescription()
323 {
324 return $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription;
325 }
326
333 public function getMetaKeywords()
334 {
335 return $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords;
336 }
337
344 public function getSearchKeywords()
345 {
346 return $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords;
347 }
348
355 public function getHasStagedChanges()
356 {
357 return $this->hasStagedChanges;
358 }
359
366 public function getPublished()
367 {
368 return $this->published;
369 }
370
377 public function getMasterVariant()
378 {
379 return $this->masterVariant instanceof ProductVariantBuilder ? $this->masterVariant->build() : $this->masterVariant;
380 }
381
388 public function getVariants()
389 {
390 return $this->variants;
391 }
392
399 public function getTaxCategory()
400 {
401 return $this->taxCategory instanceof TaxCategoryReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory;
402 }
403
410 public function getState()
411 {
412 return $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state;
413 }
414
422 {
423 return $this->reviewRatingStatistics instanceof ReviewRatingStatisticsBuilder ? $this->reviewRatingStatistics->build() : $this->reviewRatingStatistics;
424 }
425
432 public function getPriceMode()
433 {
434 return $this->priceMode;
435 }
436
443 public function getAttributes()
444 {
445 return $this->attributes;
446 }
447
452 public function withId(?string $id)
453 {
454 $this->id = $id;
455
456 return $this;
457 }
458
463 public function withVersion(?int $version)
464 {
465 $this->version = $version;
466
467 return $this;
468 }
469
474 public function withCreatedAt(?DateTimeImmutable $createdAt)
475 {
476 $this->createdAt = $createdAt;
477
478 return $this;
479 }
480
485 public function withLastModifiedAt(?DateTimeImmutable $lastModifiedAt)
486 {
487 $this->lastModifiedAt = $lastModifiedAt;
488
489 return $this;
490 }
491
496 public function withKey(?string $key)
497 {
498 $this->key = $key;
499
500 return $this;
501 }
502
507 public function withProductType(?ProductTypeReference $productType)
508 {
509 $this->productType = $productType;
510
511 return $this;
512 }
513
518 public function withName(?LocalizedString $name)
519 {
520 $this->name = $name;
521
522 return $this;
523 }
524
529 public function withDescription(?LocalizedString $description)
530 {
531 $this->description = $description;
532
533 return $this;
534 }
535
540 public function withSlug(?LocalizedString $slug)
541 {
542 $this->slug = $slug;
543
544 return $this;
545 }
546
551 public function withCategories(?CategoryReferenceCollection $categories)
552 {
553 $this->categories = $categories;
554
555 return $this;
556 }
557
562 public function withCategoryOrderHints(?CategoryOrderHints $categoryOrderHints)
563 {
564 $this->categoryOrderHints = $categoryOrderHints;
565
566 return $this;
567 }
568
573 public function withMetaTitle(?LocalizedString $metaTitle)
574 {
575 $this->metaTitle = $metaTitle;
576
577 return $this;
578 }
579
584 public function withMetaDescription(?LocalizedString $metaDescription)
585 {
586 $this->metaDescription = $metaDescription;
587
588 return $this;
589 }
590
595 public function withMetaKeywords(?LocalizedString $metaKeywords)
596 {
597 $this->metaKeywords = $metaKeywords;
598
599 return $this;
600 }
601
606 public function withSearchKeywords(?SearchKeywords $searchKeywords)
607 {
608 $this->searchKeywords = $searchKeywords;
609
610 return $this;
611 }
612
617 public function withHasStagedChanges(?bool $hasStagedChanges)
618 {
619 $this->hasStagedChanges = $hasStagedChanges;
620
621 return $this;
622 }
623
628 public function withPublished(?bool $published)
629 {
630 $this->published = $published;
631
632 return $this;
633 }
634
639 public function withMasterVariant(?ProductVariant $masterVariant)
640 {
641 $this->masterVariant = $masterVariant;
642
643 return $this;
644 }
645
650 public function withVariants(?ProductVariantCollection $variants)
651 {
652 $this->variants = $variants;
653
654 return $this;
655 }
656
661 public function withTaxCategory(?TaxCategoryReference $taxCategory)
662 {
663 $this->taxCategory = $taxCategory;
664
665 return $this;
666 }
667
672 public function withState(?StateReference $state)
673 {
674 $this->state = $state;
675
676 return $this;
677 }
678
683 public function withReviewRatingStatistics(?ReviewRatingStatistics $reviewRatingStatistics)
684 {
685 $this->reviewRatingStatistics = $reviewRatingStatistics;
686
687 return $this;
688 }
689
694 public function withPriceMode(?string $priceMode)
695 {
696 $this->priceMode = $priceMode;
697
698 return $this;
699 }
700
705 public function withAttributes(?AttributeCollection $attributes)
706 {
707 $this->attributes = $attributes;
708
709 return $this;
710 }
711
717 {
718 $this->productType = $productType;
719
720 return $this;
721 }
722
728 {
729 $this->name = $name;
730
731 return $this;
732 }
733
738 public function withDescriptionBuilder(?LocalizedStringBuilder $description)
739 {
740 $this->description = $description;
741
742 return $this;
743 }
744
750 {
751 $this->slug = $slug;
752
753 return $this;
754 }
755
760 public function withCategoryOrderHintsBuilder(?CategoryOrderHintsBuilder $categoryOrderHints)
761 {
762 $this->categoryOrderHints = $categoryOrderHints;
763
764 return $this;
765 }
766
771 public function withMetaTitleBuilder(?LocalizedStringBuilder $metaTitle)
772 {
773 $this->metaTitle = $metaTitle;
774
775 return $this;
776 }
777
782 public function withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
783 {
784 $this->metaDescription = $metaDescription;
785
786 return $this;
787 }
788
793 public function withMetaKeywordsBuilder(?LocalizedStringBuilder $metaKeywords)
794 {
795 $this->metaKeywords = $metaKeywords;
796
797 return $this;
798 }
799
804 public function withSearchKeywordsBuilder(?SearchKeywordsBuilder $searchKeywords)
805 {
806 $this->searchKeywords = $searchKeywords;
807
808 return $this;
809 }
810
815 public function withMasterVariantBuilder(?ProductVariantBuilder $masterVariant)
816 {
817 $this->masterVariant = $masterVariant;
818
819 return $this;
820 }
821
827 {
828 $this->taxCategory = $taxCategory;
829
830 return $this;
831 }
832
838 {
839 $this->state = $state;
840
841 return $this;
842 }
843
848 public function withReviewRatingStatisticsBuilder(?ReviewRatingStatisticsBuilder $reviewRatingStatistics)
849 {
850 $this->reviewRatingStatistics = $reviewRatingStatistics;
851
852 return $this;
853 }
854
855 public function build(): ProductProjection
856 {
857 return new ProductProjectionModel(
858 $this->id,
859 $this->version,
860 $this->createdAt,
861 $this->lastModifiedAt,
862 $this->key,
863 $this->productType instanceof ProductTypeReferenceBuilder ? $this->productType->build() : $this->productType,
864 $this->name instanceof LocalizedStringBuilder ? $this->name->build() : $this->name,
865 $this->description instanceof LocalizedStringBuilder ? $this->description->build() : $this->description,
866 $this->slug instanceof LocalizedStringBuilder ? $this->slug->build() : $this->slug,
867 $this->categories,
868 $this->categoryOrderHints instanceof CategoryOrderHintsBuilder ? $this->categoryOrderHints->build() : $this->categoryOrderHints,
869 $this->metaTitle instanceof LocalizedStringBuilder ? $this->metaTitle->build() : $this->metaTitle,
870 $this->metaDescription instanceof LocalizedStringBuilder ? $this->metaDescription->build() : $this->metaDescription,
871 $this->metaKeywords instanceof LocalizedStringBuilder ? $this->metaKeywords->build() : $this->metaKeywords,
872 $this->searchKeywords instanceof SearchKeywordsBuilder ? $this->searchKeywords->build() : $this->searchKeywords,
873 $this->hasStagedChanges,
874 $this->published,
875 $this->masterVariant instanceof ProductVariantBuilder ? $this->masterVariant->build() : $this->masterVariant,
876 $this->variants,
877 $this->taxCategory instanceof TaxCategoryReferenceBuilder ? $this->taxCategory->build() : $this->taxCategory,
878 $this->state instanceof StateReferenceBuilder ? $this->state->build() : $this->state,
879 $this->reviewRatingStatistics instanceof ReviewRatingStatisticsBuilder ? $this->reviewRatingStatistics->build() : $this->reviewRatingStatistics,
880 $this->priceMode,
881 $this->attributes
882 );
883 }
884
885 public static function of(): ProductProjectionBuilder
886 {
887 return new self();
888 }
889}
withReviewRatingStatistics(?ReviewRatingStatistics $reviewRatingStatistics)
withMetaDescriptionBuilder(?LocalizedStringBuilder $metaDescription)
withReviewRatingStatisticsBuilder(?ReviewRatingStatisticsBuilder $reviewRatingStatistics)
withProductTypeBuilder(?ProductTypeReferenceBuilder $productType)
withTaxCategoryBuilder(?TaxCategoryReferenceBuilder $taxCategory)
withCategoryOrderHintsBuilder(?CategoryOrderHintsBuilder $categoryOrderHints)