commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
VariantAttributesVariantModel.php
1<?php
2
3declare(strict_types=1);
10
16use stdClass;
17
22{
27 protected $id;
28
33 protected $sku;
34
39 protected $key;
40
45 protected $availability;
46
51 protected $attributes;
52
53
57 public function __construct(
58 ?string $id = null,
59 ?string $sku = null,
60 ?string $key = null,
63 ) {
64 $this->id = $id;
65 $this->sku = $sku;
66 $this->key = $key;
67 $this->availability = $availability;
68 $this->attributes = $attributes;
69 }
70
77 public function getId()
78 {
79 if (is_null($this->id)) {
81 $data = $this->raw(self::FIELD_ID);
82 if (is_null($data)) {
83 return null;
84 }
85 $this->id = (string) $data;
86 }
87
88 return $this->id;
89 }
90
97 public function getSku()
98 {
99 if (is_null($this->sku)) {
101 $data = $this->raw(self::FIELD_SKU);
102 if (is_null($data)) {
103 return null;
104 }
105 $this->sku = (string) $data;
106 }
107
108 return $this->sku;
109 }
110
117 public function getKey()
118 {
119 if (is_null($this->key)) {
121 $data = $this->raw(self::FIELD_KEY);
122 if (is_null($data)) {
123 return null;
124 }
125 $this->key = (string) $data;
126 }
127
128 return $this->key;
129 }
130
138 public function getAvailability()
139 {
140 if (is_null($this->availability)) {
142 $data = $this->raw(self::FIELD_AVAILABILITY);
143 if (is_null($data)) {
144 return null;
145 }
146
147 $this->availability = VariantAttributesAvailabilityModel::of($data);
148 }
149
150 return $this->availability;
151 }
152
160 public function getAttributes()
161 {
162 if (is_null($this->attributes)) {
164 $data = $this->raw(self::FIELD_ATTRIBUTES);
165 if (is_null($data)) {
166 return null;
167 }
168 $this->attributes = AttributeCollection::fromArray($data);
169 }
170
171 return $this->attributes;
172 }
173
174
178 public function setId(?string $id): void
179 {
180 $this->id = $id;
181 }
182
186 public function setSku(?string $sku): void
187 {
188 $this->sku = $sku;
189 }
190
194 public function setKey(?string $key): void
195 {
196 $this->key = $key;
197 }
198
203 {
204 $this->availability = $availability;
205 }
206
211 {
212 $this->attributes = $attributes;
213 }
214}
__construct(?string $id=null, ?string $sku=null, ?string $key=null, ?VariantAttributesAvailability $availability=null, ?AttributeCollection $attributes=null)