commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
SetVariantSelectionChangeModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
20 
25 {
26 
27  public const DISCRIMINATOR_VALUE = 'SetVariantSelectionChange';
32  protected $type;
33 
38  protected $change;
39 
44  protected $previousValue;
45 
50  protected $nextValue;
51 
56  protected $product;
57 
58 
62  public function __construct(
63  ?string $change = null,
66  ?Reference $product = null,
67  ?string $type = null
68  ) {
69  $this->change = $change;
70  $this->previousValue = $previousValue;
71  $this->nextValue = $nextValue;
72  $this->product = $product;
73  $this->type = $type ?? self::DISCRIMINATOR_VALUE;
74  }
75 
80  public function getType()
81  {
82  if (is_null($this->type)) {
84  $data = $this->raw(self::FIELD_TYPE);
85  if (is_null($data)) {
86  return null;
87  }
88  $this->type = (string) $data;
89  }
90 
91  return $this->type;
92  }
93 
98  public function getChange()
99  {
100  if (is_null($this->change)) {
102  $data = $this->raw(self::FIELD_CHANGE);
103  if (is_null($data)) {
104  return null;
105  }
106  $this->change = (string) $data;
107  }
108 
109  return $this->change;
110  }
111 
118  public function getPreviousValue()
119  {
120  if (is_null($this->previousValue)) {
122  $data = $this->raw(self::FIELD_PREVIOUS_VALUE);
123  if (is_null($data)) {
124  return null;
125  }
126 
127  $this->previousValue = ProductVariantSelectionModel::of($data);
128  }
129 
130  return $this->previousValue;
131  }
132 
139  public function getNextValue()
140  {
141  if (is_null($this->nextValue)) {
143  $data = $this->raw(self::FIELD_NEXT_VALUE);
144  if (is_null($data)) {
145  return null;
146  }
147 
148  $this->nextValue = ProductVariantSelectionModel::of($data);
149  }
150 
151  return $this->nextValue;
152  }
153 
160  public function getProduct()
161  {
162  if (is_null($this->product)) {
164  $data = $this->raw(self::FIELD_PRODUCT);
165  if (is_null($data)) {
166  return null;
167  }
168 
169  $this->product = ReferenceModel::of($data);
170  }
171 
172  return $this->product;
173  }
174 
175 
179  public function setChange(?string $change): void
180  {
181  $this->change = $change;
182  }
183 
188  {
189  $this->previousValue = $previousValue;
190  }
191 
196  {
197  $this->nextValue = $nextValue;
198  }
199 
203  public function setProduct(?Reference $product): void
204  {
205  $this->product = $product;
206  }
207 
208 
209 
210 }
__construct(?string $change=null, ?ProductVariantSelection $previousValue=null, ?ProductVariantSelection $nextValue=null, ?Reference $product=null, ?string $type=null)