commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ProductSelectionAssignmentModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
28  protected $product;
29 
34  protected $productSelection;
35 
40  protected $variantSelection;
41 
46  protected $variantExclusion;
47 
48 
52  public function __construct(
53  ?ProductReference $product = null,
57  ) {
58  $this->product = $product;
59  $this->productSelection = $productSelection;
60  $this->variantSelection = $variantSelection;
61  $this->variantExclusion = $variantExclusion;
62  }
63 
70  public function getProduct()
71  {
72  if (is_null($this->product)) {
74  $data = $this->raw(self::FIELD_PRODUCT);
75  if (is_null($data)) {
76  return null;
77  }
78 
79  $this->product = ProductReferenceModel::of($data);
80  }
81 
82  return $this->product;
83  }
84 
91  public function getProductSelection()
92  {
93  if (is_null($this->productSelection)) {
95  $data = $this->raw(self::FIELD_PRODUCT_SELECTION);
96  if (is_null($data)) {
97  return null;
98  }
99 
100  $this->productSelection = ProductSelectionReferenceModel::of($data);
101  }
102 
104  }
105 
114  public function getVariantSelection()
115  {
116  if (is_null($this->variantSelection)) {
118  $data = $this->raw(self::FIELD_VARIANT_SELECTION);
119  if (is_null($data)) {
120  return null;
121  }
123  $this->variantSelection = $className::of($data);
124  }
125 
127  }
128 
137  public function getVariantExclusion()
138  {
139  if (is_null($this->variantExclusion)) {
141  $data = $this->raw(self::FIELD_VARIANT_EXCLUSION);
142  if (is_null($data)) {
143  return null;
144  }
145 
146  $this->variantExclusion = ProductVariantExclusionModel::of($data);
147  }
148 
150  }
151 
152 
156  public function setProduct(?ProductReference $product): void
157  {
158  $this->product = $product;
159  }
160 
165  {
166  $this->productSelection = $productSelection;
167  }
168 
173  {
174  $this->variantSelection = $variantSelection;
175  }
176 
181  {
182  $this->variantExclusion = $variantExclusion;
183  }
184 }
__construct(?ProductReference $product=null, ?ProductSelectionReference $productSelection=null, ?ProductVariantSelection $variantSelection=null, ?ProductVariantExclusion $variantExclusion=null)