commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
CustomFieldsDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
21 {
26  protected $type;
27 
32  protected $fields;
33 
34 
38  public function __construct(
40  ?FieldContainer $fields = null
41  ) {
42  $this->type = $type;
43  $this->fields = $fields;
44  }
45 
52  public function getType()
53  {
54  if (is_null($this->type)) {
56  $data = $this->raw(self::FIELD_TYPE);
57  if (is_null($data)) {
58  return null;
59  }
60 
61  $this->type = TypeResourceIdentifierModel::of($data);
62  }
63 
64  return $this->type;
65  }
66 
73  public function getFields()
74  {
75  if (is_null($this->fields)) {
77  $data = $this->raw(self::FIELD_FIELDS);
78  if (is_null($data)) {
79  return null;
80  }
81 
82  $this->fields = FieldContainerModel::of($data);
83  }
84 
85  return $this->fields;
86  }
87 
88 
92  public function setType(?TypeResourceIdentifier $type): void
93  {
94  $this->type = $type;
95  }
96 
100  public function setFields(?FieldContainer $fields): void
101  {
102  $this->fields = $fields;
103  }
104 }
__construct(?TypeResourceIdentifier $type=null, ?FieldContainer $fields=null)
static of($data=null)
Definition: MapperMap.php:45