commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
CategoryImportModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
24 use stdClass;
25 
29 final class CategoryImportModel extends JsonObjectModel implements CategoryImport
30 {
35  protected $key;
36 
41  protected $name;
42 
47  protected $slug;
48 
53  protected $description;
54 
59  protected $parent;
60 
65  protected $orderHint;
66 
71  protected $externalId;
72 
77  protected $metaTitle;
78 
83  protected $metaDescription;
84 
89  protected $metaKeywords;
90 
95  protected $assets;
96 
101  protected $custom;
102 
103 
107  public function __construct(
108  ?string $key = null,
109  ?LocalizedString $name = null,
110  ?LocalizedString $slug = null,
113  ?string $orderHint = null,
114  ?string $externalId = null,
115  ?LocalizedString $metaTitle = null,
118  ?AssetCollection $assets = null,
119  ?Custom $custom = null
120  ) {
121  $this->key = $key;
122  $this->name = $name;
123  $this->slug = $slug;
124  $this->description = $description;
125  $this->parent = $parent;
126  $this->orderHint = $orderHint;
127  $this->externalId = $externalId;
128  $this->metaTitle = $metaTitle;
129  $this->metaDescription = $metaDescription;
130  $this->metaKeywords = $metaKeywords;
131  $this->assets = $assets;
132  $this->custom = $custom;
133  }
134 
141  public function getKey()
142  {
143  if (is_null($this->key)) {
145  $data = $this->raw(self::FIELD_KEY);
146  if (is_null($data)) {
147  return null;
148  }
149  $this->key = (string) $data;
150  }
151 
152  return $this->key;
153  }
154 
161  public function getName()
162  {
163  if (is_null($this->name)) {
165  $data = $this->raw(self::FIELD_NAME);
166  if (is_null($data)) {
167  return null;
168  }
169 
170  $this->name = LocalizedStringModel::of($data);
171  }
172 
173  return $this->name;
174  }
175 
183  public function getSlug()
184  {
185  if (is_null($this->slug)) {
187  $data = $this->raw(self::FIELD_SLUG);
188  if (is_null($data)) {
189  return null;
190  }
191 
192  $this->slug = LocalizedStringModel::of($data);
193  }
194 
195  return $this->slug;
196  }
197 
204  public function getDescription()
205  {
206  if (is_null($this->description)) {
208  $data = $this->raw(self::FIELD_DESCRIPTION);
209  if (is_null($data)) {
210  return null;
211  }
212 
213  $this->description = LocalizedStringModel::of($data);
214  }
215 
216  return $this->description;
217  }
218 
227  public function getParent()
228  {
229  if (is_null($this->parent)) {
231  $data = $this->raw(self::FIELD_PARENT);
232  if (is_null($data)) {
233  return null;
234  }
235 
236  $this->parent = CategoryKeyReferenceModel::of($data);
237  }
238 
239  return $this->parent;
240  }
241 
248  public function getOrderHint()
249  {
250  if (is_null($this->orderHint)) {
252  $data = $this->raw(self::FIELD_ORDER_HINT);
253  if (is_null($data)) {
254  return null;
255  }
256  $this->orderHint = (string) $data;
257  }
258 
259  return $this->orderHint;
260  }
261 
268  public function getExternalId()
269  {
270  if (is_null($this->externalId)) {
272  $data = $this->raw(self::FIELD_EXTERNAL_ID);
273  if (is_null($data)) {
274  return null;
275  }
276  $this->externalId = (string) $data;
277  }
278 
279  return $this->externalId;
280  }
281 
288  public function getMetaTitle()
289  {
290  if (is_null($this->metaTitle)) {
292  $data = $this->raw(self::FIELD_META_TITLE);
293  if (is_null($data)) {
294  return null;
295  }
296 
297  $this->metaTitle = LocalizedStringModel::of($data);
298  }
299 
300  return $this->metaTitle;
301  }
302 
309  public function getMetaDescription()
310  {
311  if (is_null($this->metaDescription)) {
313  $data = $this->raw(self::FIELD_META_DESCRIPTION);
314  if (is_null($data)) {
315  return null;
316  }
317 
318  $this->metaDescription = LocalizedStringModel::of($data);
319  }
320 
321  return $this->metaDescription;
322  }
323 
330  public function getMetaKeywords()
331  {
332  if (is_null($this->metaKeywords)) {
334  $data = $this->raw(self::FIELD_META_KEYWORDS);
335  if (is_null($data)) {
336  return null;
337  }
338 
339  $this->metaKeywords = LocalizedStringModel::of($data);
340  }
341 
342  return $this->metaKeywords;
343  }
344 
349  public function getAssets()
350  {
351  if (is_null($this->assets)) {
353  $data = $this->raw(self::FIELD_ASSETS);
354  if (is_null($data)) {
355  return null;
356  }
357  $this->assets = AssetCollection::fromArray($data);
358  }
359 
360  return $this->assets;
361  }
362 
369  public function getCustom()
370  {
371  if (is_null($this->custom)) {
373  $data = $this->raw(self::FIELD_CUSTOM);
374  if (is_null($data)) {
375  return null;
376  }
377 
378  $this->custom = CustomModel::of($data);
379  }
380 
381  return $this->custom;
382  }
383 
384 
388  public function setKey(?string $key): void
389  {
390  $this->key = $key;
391  }
392 
396  public function setName(?LocalizedString $name): void
397  {
398  $this->name = $name;
399  }
400 
404  public function setSlug(?LocalizedString $slug): void
405  {
406  $this->slug = $slug;
407  }
408 
413  {
414  $this->description = $description;
415  }
416 
420  public function setParent(?CategoryKeyReference $parent): void
421  {
422  $this->parent = $parent;
423  }
424 
428  public function setOrderHint(?string $orderHint): void
429  {
430  $this->orderHint = $orderHint;
431  }
432 
436  public function setExternalId(?string $externalId): void
437  {
438  $this->externalId = $externalId;
439  }
440 
444  public function setMetaTitle(?LocalizedString $metaTitle): void
445  {
446  $this->metaTitle = $metaTitle;
447  }
448 
453  {
454  $this->metaDescription = $metaDescription;
455  }
456 
461  {
462  $this->metaKeywords = $metaKeywords;
463  }
464 
468  public function setAssets(?AssetCollection $assets): void
469  {
470  $this->assets = $assets;
471  }
472 
476  public function setCustom(?Custom $custom): void
477  {
478  $this->custom = $custom;
479  }
480 }
static of($data=null)
Definition: MapperMap.php:45
__construct(?string $key=null, ?LocalizedString $name=null, ?LocalizedString $slug=null, ?LocalizedString $description=null, ?CategoryKeyReference $parent=null, ?string $orderHint=null, ?string $externalId=null, ?LocalizedString $metaTitle=null, ?LocalizedString $metaDescription=null, ?LocalizedString $metaKeywords=null, ?AssetCollection $assets=null, ?Custom $custom=null)