commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
VariantKeySetMessagePayloadModel.php
1<?php
2
3declare(strict_types=1);
10
17use stdClass;
18
23{
24 public const DISCRIMINATOR_VALUE = 'VariantKeySet';
29 protected $type;
30
35 protected $product;
36
41 protected $key;
42
47 protected $oldKey;
48
49
53 public function __construct(
55 ?string $key = null,
56 ?string $oldKey = null,
57 ?string $type = null
58 ) {
59 $this->product = $product;
60 $this->key = $key;
61 $this->oldKey = $oldKey;
62 $this->type = $type ?? self::DISCRIMINATOR_VALUE;
63 }
64
69 public function getType()
70 {
71 if (is_null($this->type)) {
73 $data = $this->raw(self::FIELD_TYPE);
74 if (is_null($data)) {
75 return null;
76 }
77 $this->type = (string) $data;
78 }
79
80 return $this->type;
81 }
82
89 public function getProduct()
90 {
91 if (is_null($this->product)) {
93 $data = $this->raw(self::FIELD_PRODUCT);
94 if (is_null($data)) {
95 return null;
96 }
97
98 $this->product = ProductReferenceModel::of($data);
99 }
100
101 return $this->product;
102 }
103
110 public function getKey()
111 {
112 if (is_null($this->key)) {
114 $data = $this->raw(self::FIELD_KEY);
115 if (is_null($data)) {
116 return null;
117 }
118 $this->key = (string) $data;
119 }
120
121 return $this->key;
122 }
123
130 public function getOldKey()
131 {
132 if (is_null($this->oldKey)) {
134 $data = $this->raw(self::FIELD_OLD_KEY);
135 if (is_null($data)) {
136 return null;
137 }
138 $this->oldKey = (string) $data;
139 }
140
141 return $this->oldKey;
142 }
143
144
148 public function setProduct(?ProductReference $product): void
149 {
150 $this->product = $product;
151 }
152
156 public function setKey(?string $key): void
157 {
158 $this->key = $key;
159 }
160
164 public function setOldKey(?string $oldKey): void
165 {
166 $this->oldKey = $oldKey;
167 }
168}
__construct(?ProductReference $product=null, ?string $key=null, ?string $oldKey=null, ?string $type=null)