commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CategoryDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
20 use stdClass;
21 
25 final class CategoryDraftModel extends JsonObjectModel implements CategoryDraft
26 {
31  protected $name;
32 
37  protected $slug;
38 
43  protected $description;
44 
49  protected $parent;
50 
55  protected $orderHint;
56 
61  protected $externalId;
62 
67  protected $metaTitle;
68 
73  protected $metaDescription;
74 
79  protected $metaKeywords;
80 
85  protected $custom;
86 
91  protected $assets;
92 
97  protected $key;
98 
99 
103  public function __construct(
104  ?LocalizedString $name = null,
105  ?LocalizedString $slug = null,
108  ?string $orderHint = null,
109  ?string $externalId = null,
110  ?LocalizedString $metaTitle = null,
113  ?CustomFieldsDraft $custom = null,
115  ?string $key = null
116  ) {
117  $this->name = $name;
118  $this->slug = $slug;
119  $this->description = $description;
120  $this->parent = $parent;
121  $this->orderHint = $orderHint;
122  $this->externalId = $externalId;
123  $this->metaTitle = $metaTitle;
124  $this->metaDescription = $metaDescription;
125  $this->metaKeywords = $metaKeywords;
126  $this->custom = $custom;
127  $this->assets = $assets;
128  $this->key = $key;
129  }
130 
137  public function getName()
138  {
139  if (is_null($this->name)) {
141  $data = $this->raw(self::FIELD_NAME);
142  if (is_null($data)) {
143  return null;
144  }
145 
146  $this->name = LocalizedStringModel::of($data);
147  }
148 
149  return $this->name;
150  }
151 
160  public function getSlug()
161  {
162  if (is_null($this->slug)) {
164  $data = $this->raw(self::FIELD_SLUG);
165  if (is_null($data)) {
166  return null;
167  }
168 
169  $this->slug = LocalizedStringModel::of($data);
170  }
171 
172  return $this->slug;
173  }
174 
181  public function getDescription()
182  {
183  if (is_null($this->description)) {
185  $data = $this->raw(self::FIELD_DESCRIPTION);
186  if (is_null($data)) {
187  return null;
188  }
189 
190  $this->description = LocalizedStringModel::of($data);
191  }
192 
193  return $this->description;
194  }
195 
203  public function getParent()
204  {
205  if (is_null($this->parent)) {
207  $data = $this->raw(self::FIELD_PARENT);
208  if (is_null($data)) {
209  return null;
210  }
211 
212  $this->parent = CategoryResourceIdentifierModel::of($data);
213  }
214 
215  return $this->parent;
216  }
217 
225  public function getOrderHint()
226  {
227  if (is_null($this->orderHint)) {
229  $data = $this->raw(self::FIELD_ORDER_HINT);
230  if (is_null($data)) {
231  return null;
232  }
233  $this->orderHint = (string) $data;
234  }
235 
236  return $this->orderHint;
237  }
238 
245  public function getExternalId()
246  {
247  if (is_null($this->externalId)) {
249  $data = $this->raw(self::FIELD_EXTERNAL_ID);
250  if (is_null($data)) {
251  return null;
252  }
253  $this->externalId = (string) $data;
254  }
255 
256  return $this->externalId;
257  }
258 
265  public function getMetaTitle()
266  {
267  if (is_null($this->metaTitle)) {
269  $data = $this->raw(self::FIELD_META_TITLE);
270  if (is_null($data)) {
271  return null;
272  }
273 
274  $this->metaTitle = LocalizedStringModel::of($data);
275  }
276 
277  return $this->metaTitle;
278  }
279 
286  public function getMetaDescription()
287  {
288  if (is_null($this->metaDescription)) {
290  $data = $this->raw(self::FIELD_META_DESCRIPTION);
291  if (is_null($data)) {
292  return null;
293  }
294 
295  $this->metaDescription = LocalizedStringModel::of($data);
296  }
297 
298  return $this->metaDescription;
299  }
300 
307  public function getMetaKeywords()
308  {
309  if (is_null($this->metaKeywords)) {
311  $data = $this->raw(self::FIELD_META_KEYWORDS);
312  if (is_null($data)) {
313  return null;
314  }
315 
316  $this->metaKeywords = LocalizedStringModel::of($data);
317  }
318 
319  return $this->metaKeywords;
320  }
321 
328  public function getCustom()
329  {
330  if (is_null($this->custom)) {
332  $data = $this->raw(self::FIELD_CUSTOM);
333  if (is_null($data)) {
334  return null;
335  }
336 
337  $this->custom = CustomFieldsDraftModel::of($data);
338  }
339 
340  return $this->custom;
341  }
342 
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 = AssetDraftCollection::fromArray($data);
358  }
359 
360  return $this->assets;
361  }
362 
370  public function getKey()
371  {
372  if (is_null($this->key)) {
374  $data = $this->raw(self::FIELD_KEY);
375  if (is_null($data)) {
376  return null;
377  }
378  $this->key = (string) $data;
379  }
380 
381  return $this->key;
382  }
383 
384 
388  public function setName(?LocalizedString $name): void
389  {
390  $this->name = $name;
391  }
392 
396  public function setSlug(?LocalizedString $slug): void
397  {
398  $this->slug = $slug;
399  }
400 
405  {
406  $this->description = $description;
407  }
408 
413  {
414  $this->parent = $parent;
415  }
416 
420  public function setOrderHint(?string $orderHint): void
421  {
422  $this->orderHint = $orderHint;
423  }
424 
428  public function setExternalId(?string $externalId): void
429  {
430  $this->externalId = $externalId;
431  }
432 
436  public function setMetaTitle(?LocalizedString $metaTitle): void
437  {
438  $this->metaTitle = $metaTitle;
439  }
440 
445  {
446  $this->metaDescription = $metaDescription;
447  }
448 
453  {
454  $this->metaKeywords = $metaKeywords;
455  }
456 
460  public function setCustom(?CustomFieldsDraft $custom): void
461  {
462  $this->custom = $custom;
463  }
464 
468  public function setAssets(?AssetDraftCollection $assets): void
469  {
470  $this->assets = $assets;
471  }
472 
476  public function setKey(?string $key): void
477  {
478  $this->key = $key;
479  }
480 }
__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)
setMetaDescription(?LocalizedString $metaDescription)
static of($data=null)
Definition: MapperMap.php:45