commercetools-sdk-php-v2  master
The platform, import-api and ml-api PHP sdks generated from our api reference.
TypeImportModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
19 use stdClass;
20 
24 final class TypeImportModel extends JsonObjectModel implements TypeImport
25 {
30  protected $key;
31 
36  protected $name;
37 
42  protected $description;
43 
48  protected $resourceTypeIds;
49 
54  protected $fieldDefinitions;
55 
56 
60  public function __construct(
61  ?string $key = null,
62  ?LocalizedString $name = null,
64  ?array $resourceTypeIds = null,
66  ) {
67  $this->key = $key;
68  $this->name = $name;
69  $this->description = $description;
70  $this->resourceTypeIds = $resourceTypeIds;
71  $this->fieldDefinitions = $fieldDefinitions;
72  }
73 
80  public function getKey()
81  {
82  if (is_null($this->key)) {
84  $data = $this->raw(self::FIELD_KEY);
85  if (is_null($data)) {
86  return null;
87  }
88  $this->key = (string) $data;
89  }
90 
91  return $this->key;
92  }
93 
100  public function getName()
101  {
102  if (is_null($this->name)) {
104  $data = $this->raw(self::FIELD_NAME);
105  if (is_null($data)) {
106  return null;
107  }
108 
109  $this->name = LocalizedStringModel::of($data);
110  }
111 
112  return $this->name;
113  }
114 
121  public function getDescription()
122  {
123  if (is_null($this->description)) {
125  $data = $this->raw(self::FIELD_DESCRIPTION);
126  if (is_null($data)) {
127  return null;
128  }
129 
130  $this->description = LocalizedStringModel::of($data);
131  }
132 
133  return $this->description;
134  }
135 
142  public function getResourceTypeIds()
143  {
144  if (is_null($this->resourceTypeIds)) {
146  $data = $this->raw(self::FIELD_RESOURCE_TYPE_IDS);
147  if (is_null($data)) {
148  return null;
149  }
150  $this->resourceTypeIds = $data;
151  }
152 
153  return $this->resourceTypeIds;
154  }
155 
162  public function getFieldDefinitions()
163  {
164  if (is_null($this->fieldDefinitions)) {
166  $data = $this->raw(self::FIELD_FIELD_DEFINITIONS);
167  if (is_null($data)) {
168  return null;
169  }
170  $this->fieldDefinitions = FieldDefinitionCollection::fromArray($data);
171  }
172 
174  }
175 
176 
180  public function setKey(?string $key): void
181  {
182  $this->key = $key;
183  }
184 
188  public function setName(?LocalizedString $name): void
189  {
190  $this->name = $name;
191  }
192 
197  {
198  $this->description = $description;
199  }
200 
204  public function setResourceTypeIds(?array $resourceTypeIds): void
205  {
206  $this->resourceTypeIds = $resourceTypeIds;
207  }
208 
213  {
214  $this->fieldDefinitions = $fieldDefinitions;
215  }
216 }
static of($data=null)
Definition: MapperMap.php:45
__construct(?string $key=null, ?LocalizedString $name=null, ?LocalizedString $description=null, ?array $resourceTypeIds=null, ?FieldDefinitionCollection $fieldDefinitions=null)
setFieldDefinitions(?FieldDefinitionCollection $fieldDefinitions)