commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
AssignedProductReferenceModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
28  protected $product;
29 
34  protected $variantSelection;
35 
40  protected $variantExclusion;
41 
42 
46  public function __construct(
47  ?ProductReference $product = null,
50  ) {
51  $this->product = $product;
52  $this->variantSelection = $variantSelection;
53  $this->variantExclusion = $variantExclusion;
54  }
55 
62  public function getProduct()
63  {
64  if (is_null($this->product)) {
66  $data = $this->raw(self::FIELD_PRODUCT);
67  if (is_null($data)) {
68  return null;
69  }
70 
71  $this->product = ProductReferenceModel::of($data);
72  }
73 
74  return $this->product;
75  }
76 
85  public function getVariantSelection()
86  {
87  if (is_null($this->variantSelection)) {
89  $data = $this->raw(self::FIELD_VARIANT_SELECTION);
90  if (is_null($data)) {
91  return null;
92  }
94  $this->variantSelection = $className::of($data);
95  }
96 
98  }
99 
108  public function getVariantExclusion()
109  {
110  if (is_null($this->variantExclusion)) {
112  $data = $this->raw(self::FIELD_VARIANT_EXCLUSION);
113  if (is_null($data)) {
114  return null;
115  }
116 
117  $this->variantExclusion = ProductVariantExclusionModel::of($data);
118  }
119 
121  }
122 
123 
127  public function setProduct(?ProductReference $product): void
128  {
129  $this->product = $product;
130  }
131 
136  {
137  $this->variantSelection = $variantSelection;
138  }
139 
144  {
145  $this->variantExclusion = $variantExclusion;
146  }
147 }
__construct(?ProductReference $product=null, ?ProductVariantSelection $variantSelection=null, ?ProductVariantExclusion $variantExclusion=null)