commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
CategoryDraftModel.php
1<?php
2
3declare(strict_types=1);
10
21use stdClass;
22
26final class CategoryDraftModel extends JsonObjectModel implements CategoryDraft
27{
32 protected $name;
33
38 protected $slug;
39
44 protected $description;
45
50 protected $parent;
51
56 protected $orderHint;
57
62 protected $externalId;
63
68 protected $metaTitle;
69
75
80 protected $metaKeywords;
81
86 protected $custom;
87
92 protected $assets;
93
98 protected $key;
99
104 protected $stores;
105
106
110 public function __construct(
111 ?LocalizedString $name = null,
112 ?LocalizedString $slug = null,
115 ?string $orderHint = null,
116 ?string $externalId = null,
122 ?string $key = null,
124 ) {
125 $this->name = $name;
126 $this->slug = $slug;
127 $this->description = $description;
128 $this->parent = $parent;
129 $this->orderHint = $orderHint;
130 $this->externalId = $externalId;
131 $this->metaTitle = $metaTitle;
132 $this->metaDescription = $metaDescription;
133 $this->metaKeywords = $metaKeywords;
134 $this->custom = $custom;
135 $this->assets = $assets;
136 $this->key = $key;
137 $this->stores = $stores;
138 }
139
146 public function getName()
147 {
148 if (is_null($this->name)) {
150 $data = $this->raw(self::FIELD_NAME);
151 if (is_null($data)) {
152 return null;
153 }
154
155 $this->name = LocalizedStringModel::of($data);
156 }
157
158 return $this->name;
159 }
160
169 public function getSlug()
170 {
171 if (is_null($this->slug)) {
173 $data = $this->raw(self::FIELD_SLUG);
174 if (is_null($data)) {
175 return null;
176 }
177
178 $this->slug = LocalizedStringModel::of($data);
179 }
180
181 return $this->slug;
182 }
183
190 public function getDescription()
191 {
192 if (is_null($this->description)) {
194 $data = $this->raw(self::FIELD_DESCRIPTION);
195 if (is_null($data)) {
196 return null;
197 }
198
199 $this->description = LocalizedStringModel::of($data);
200 }
201
202 return $this->description;
203 }
204
212 public function getParent()
213 {
214 if (is_null($this->parent)) {
216 $data = $this->raw(self::FIELD_PARENT);
217 if (is_null($data)) {
218 return null;
219 }
220
221 $this->parent = CategoryResourceIdentifierModel::of($data);
222 }
223
224 return $this->parent;
225 }
226
234 public function getOrderHint()
235 {
236 if (is_null($this->orderHint)) {
238 $data = $this->raw(self::FIELD_ORDER_HINT);
239 if (is_null($data)) {
240 return null;
241 }
242 $this->orderHint = (string) $data;
243 }
244
245 return $this->orderHint;
246 }
247
254 public function getExternalId()
255 {
256 if (is_null($this->externalId)) {
258 $data = $this->raw(self::FIELD_EXTERNAL_ID);
259 if (is_null($data)) {
260 return null;
261 }
262 $this->externalId = (string) $data;
263 }
264
265 return $this->externalId;
266 }
267
274 public function getMetaTitle()
275 {
276 if (is_null($this->metaTitle)) {
278 $data = $this->raw(self::FIELD_META_TITLE);
279 if (is_null($data)) {
280 return null;
281 }
282
283 $this->metaTitle = LocalizedStringModel::of($data);
284 }
285
286 return $this->metaTitle;
287 }
288
295 public function getMetaDescription()
296 {
297 if (is_null($this->metaDescription)) {
299 $data = $this->raw(self::FIELD_META_DESCRIPTION);
300 if (is_null($data)) {
301 return null;
302 }
303
304 $this->metaDescription = LocalizedStringModel::of($data);
305 }
306
308 }
309
316 public function getMetaKeywords()
317 {
318 if (is_null($this->metaKeywords)) {
320 $data = $this->raw(self::FIELD_META_KEYWORDS);
321 if (is_null($data)) {
322 return null;
323 }
324
325 $this->metaKeywords = LocalizedStringModel::of($data);
326 }
327
328 return $this->metaKeywords;
329 }
330
337 public function getCustom()
338 {
339 if (is_null($this->custom)) {
341 $data = $this->raw(self::FIELD_CUSTOM);
342 if (is_null($data)) {
343 return null;
344 }
345
346 $this->custom = CustomFieldsDraftModel::of($data);
347 }
348
349 return $this->custom;
350 }
351
358 public function getAssets()
359 {
360 if (is_null($this->assets)) {
362 $data = $this->raw(self::FIELD_ASSETS);
363 if (is_null($data)) {
364 return null;
365 }
366 $this->assets = AssetDraftCollection::fromArray($data);
367 }
368
369 return $this->assets;
370 }
371
379 public function getKey()
380 {
381 if (is_null($this->key)) {
383 $data = $this->raw(self::FIELD_KEY);
384 if (is_null($data)) {
385 return null;
386 }
387 $this->key = (string) $data;
388 }
389
390 return $this->key;
391 }
392
408 public function getStores()
409 {
410 if (is_null($this->stores)) {
412 $data = $this->raw(self::FIELD_STORES);
413 if (is_null($data)) {
414 return null;
415 }
416 $this->stores = StoreResourceIdentifierCollection::fromArray($data);
417 }
418
419 return $this->stores;
420 }
421
422
426 public function setName(?LocalizedString $name): void
427 {
428 $this->name = $name;
429 }
430
434 public function setSlug(?LocalizedString $slug): void
435 {
436 $this->slug = $slug;
437 }
438
443 {
444 $this->description = $description;
445 }
446
451 {
452 $this->parent = $parent;
453 }
454
458 public function setOrderHint(?string $orderHint): void
459 {
460 $this->orderHint = $orderHint;
461 }
462
466 public function setExternalId(?string $externalId): void
467 {
468 $this->externalId = $externalId;
469 }
470
475 {
476 $this->metaTitle = $metaTitle;
477 }
478
483 {
484 $this->metaDescription = $metaDescription;
485 }
486
491 {
492 $this->metaKeywords = $metaKeywords;
493 }
494
498 public function setCustom(?CustomFieldsDraft $custom): void
499 {
500 $this->custom = $custom;
501 }
502
506 public function setAssets(?AssetDraftCollection $assets): void
507 {
508 $this->assets = $assets;
509 }
510
514 public function setKey(?string $key): void
515 {
516 $this->key = $key;
517 }
518
523 {
524 $this->stores = $stores;
525 }
526}
setStores(?StoreResourceIdentifierCollection $stores)
__construct(?LocalizedString $name=null, ?LocalizedString $slug=null, ?LocalizedString $description=null, ?CategoryResourceIdentifier $parent=null, ?string $orderHint=null, ?string $externalId=null, ?LocalizedString $metaTitle=null, ?LocalizedString $metaDescription=null, ?LocalizedString $metaKeywords=null, ?CustomFieldsDraft $custom=null, ?AssetDraftCollection $assets=null, ?string $key=null, ?StoreResourceIdentifierCollection $stores=null)