commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
VariantImageAddedMessagePayloadModel.php
1<?php
2
3declare(strict_types=1);
10
19use stdClass;
20
25{
26 public const DISCRIMINATOR_VALUE = 'VariantImageAdded';
31 protected $type;
32
37 protected $product;
38
43 protected $image;
44
49 protected $staged;
50
51
55 public function __construct(
57 ?Image $image = null,
58 ?bool $staged = null,
59 ?string $type = null
60 ) {
61 $this->product = $product;
62 $this->image = $image;
63 $this->staged = $staged;
64 $this->type = $type ?? self::DISCRIMINATOR_VALUE;
65 }
66
71 public function getType()
72 {
73 if (is_null($this->type)) {
75 $data = $this->raw(self::FIELD_TYPE);
76 if (is_null($data)) {
77 return null;
78 }
79 $this->type = (string) $data;
80 }
81
82 return $this->type;
83 }
84
91 public function getProduct()
92 {
93 if (is_null($this->product)) {
95 $data = $this->raw(self::FIELD_PRODUCT);
96 if (is_null($data)) {
97 return null;
98 }
99
100 $this->product = ProductReferenceModel::of($data);
101 }
102
103 return $this->product;
104 }
105
112 public function getImage()
113 {
114 if (is_null($this->image)) {
116 $data = $this->raw(self::FIELD_IMAGE);
117 if (is_null($data)) {
118 return null;
119 }
120
121 $this->image = ImageModel::of($data);
122 }
123
124 return $this->image;
125 }
126
133 public function getStaged()
134 {
135 if (is_null($this->staged)) {
137 $data = $this->raw(self::FIELD_STAGED);
138 if (is_null($data)) {
139 return null;
140 }
141 $this->staged = (bool) $data;
142 }
143
144 return $this->staged;
145 }
146
147
151 public function setProduct(?ProductReference $product): void
152 {
153 $this->product = $product;
154 }
155
159 public function setImage(?Image $image): void
160 {
161 $this->image = $image;
162 }
163
167 public function setStaged(?bool $staged): void
168 {
169 $this->staged = $staged;
170 }
171}
__construct(?ProductReference $product=null, ?Image $image=null, ?bool $staged=null, ?string $type=null)