commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
VariantCreatedMessagePayloadModel.php
1<?php
2
3declare(strict_types=1);
10
20use stdClass;
21
26{
27 public const DISCRIMINATOR_VALUE = 'VariantCreated';
32 protected $type;
33
38 protected $product;
39
44 protected $id;
45
50 protected $variantId;
51
56 protected $key;
57
62 protected $sku;
63
68 protected $attributes;
69
74 protected $assets;
75
80 protected $images;
81
86 protected $publish;
87
88
92 public function __construct(
94 ?string $id = null,
95 ?int $variantId = null,
96 ?string $key = null,
97 ?string $sku = null,
100 ?ImageCollection $images = null,
101 ?bool $publish = null,
102 ?string $type = null
103 ) {
104 $this->product = $product;
105 $this->id = $id;
106 $this->variantId = $variantId;
107 $this->key = $key;
108 $this->sku = $sku;
109 $this->attributes = $attributes;
110 $this->assets = $assets;
111 $this->images = $images;
112 $this->publish = $publish;
113 $this->type = $type ?? self::DISCRIMINATOR_VALUE;
114 }
115
120 public function getType()
121 {
122 if (is_null($this->type)) {
124 $data = $this->raw(self::FIELD_TYPE);
125 if (is_null($data)) {
126 return null;
127 }
128 $this->type = (string) $data;
129 }
130
131 return $this->type;
132 }
133
140 public function getProduct()
141 {
142 if (is_null($this->product)) {
144 $data = $this->raw(self::FIELD_PRODUCT);
145 if (is_null($data)) {
146 return null;
147 }
148
149 $this->product = ProductReferenceModel::of($data);
150 }
151
152 return $this->product;
153 }
154
161 public function getId()
162 {
163 if (is_null($this->id)) {
165 $data = $this->raw(self::FIELD_ID);
166 if (is_null($data)) {
167 return null;
168 }
169 $this->id = (string) $data;
170 }
171
172 return $this->id;
173 }
174
181 public function getVariantId()
182 {
183 if (is_null($this->variantId)) {
185 $data = $this->raw(self::FIELD_VARIANT_ID);
186 if (is_null($data)) {
187 return null;
188 }
189 $this->variantId = (int) $data;
190 }
191
192 return $this->variantId;
193 }
194
201 public function getKey()
202 {
203 if (is_null($this->key)) {
205 $data = $this->raw(self::FIELD_KEY);
206 if (is_null($data)) {
207 return null;
208 }
209 $this->key = (string) $data;
210 }
211
212 return $this->key;
213 }
214
221 public function getSku()
222 {
223 if (is_null($this->sku)) {
225 $data = $this->raw(self::FIELD_SKU);
226 if (is_null($data)) {
227 return null;
228 }
229 $this->sku = (string) $data;
230 }
231
232 return $this->sku;
233 }
234
241 public function getAttributes()
242 {
243 if (is_null($this->attributes)) {
245 $data = $this->raw(self::FIELD_ATTRIBUTES);
246 if (is_null($data)) {
247 return null;
248 }
249 $this->attributes = AttributeCollection::fromArray($data);
250 }
251
252 return $this->attributes;
253 }
254
261 public function getAssets()
262 {
263 if (is_null($this->assets)) {
265 $data = $this->raw(self::FIELD_ASSETS);
266 if (is_null($data)) {
267 return null;
268 }
269 $this->assets = AssetCollection::fromArray($data);
270 }
271
272 return $this->assets;
273 }
274
281 public function getImages()
282 {
283 if (is_null($this->images)) {
285 $data = $this->raw(self::FIELD_IMAGES);
286 if (is_null($data)) {
287 return null;
288 }
289 $this->images = ImageCollection::fromArray($data);
290 }
291
292 return $this->images;
293 }
294
301 public function getPublish()
302 {
303 if (is_null($this->publish)) {
305 $data = $this->raw(self::FIELD_PUBLISH);
306 if (is_null($data)) {
307 return null;
308 }
309 $this->publish = (bool) $data;
310 }
311
312 return $this->publish;
313 }
314
315
319 public function setProduct(?ProductReference $product): void
320 {
321 $this->product = $product;
322 }
323
327 public function setId(?string $id): void
328 {
329 $this->id = $id;
330 }
331
335 public function setVariantId(?int $variantId): void
336 {
337 $this->variantId = $variantId;
338 }
339
343 public function setKey(?string $key): void
344 {
345 $this->key = $key;
346 }
347
351 public function setSku(?string $sku): void
352 {
353 $this->sku = $sku;
354 }
355
360 {
361 $this->attributes = $attributes;
362 }
363
367 public function setAssets(?AssetCollection $assets): void
368 {
369 $this->assets = $assets;
370 }
371
375 public function setImages(?ImageCollection $images): void
376 {
377 $this->images = $images;
378 }
379
383 public function setPublish(?bool $publish): void
384 {
385 $this->publish = $publish;
386 }
387}
__construct(?ProductReference $product=null, ?string $id=null, ?int $variantId=null, ?string $key=null, ?string $sku=null, ?AttributeCollection $attributes=null, ?AssetCollection $assets=null, ?ImageCollection $images=null, ?bool $publish=null, ?string $type=null)