commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
AttributeDefinitionDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
17 use stdClass;
18 
23 {
28  protected $type;
29 
34  protected $name;
35 
40  protected $label;
41 
46  protected $isRequired;
47 
53 
58  protected $inputTip;
59 
64  protected $inputHint;
65 
70  protected $isSearchable;
71 
72 
76  public function __construct(
77  ?AttributeType $type = null,
78  ?string $name = null,
79  ?LocalizedString $label = null,
80  ?bool $isRequired = null,
81  ?string $attributeConstraint = null,
82  ?LocalizedString $inputTip = null,
83  ?string $inputHint = null,
84  ?bool $isSearchable = null
85  ) {
86  $this->type = $type;
87  $this->name = $name;
88  $this->label = $label;
89  $this->isRequired = $isRequired;
90  $this->attributeConstraint = $attributeConstraint;
91  $this->inputTip = $inputTip;
92  $this->inputHint = $inputHint;
93  $this->isSearchable = $isSearchable;
94  }
95 
103  public function getType()
104  {
105  if (is_null($this->type)) {
107  $data = $this->raw(self::FIELD_TYPE);
108  if (is_null($data)) {
109  return null;
110  }
112  $this->type = $className::of($data);
113  }
114 
115  return $this->type;
116  }
117 
126  public function getName()
127  {
128  if (is_null($this->name)) {
130  $data = $this->raw(self::FIELD_NAME);
131  if (is_null($data)) {
132  return null;
133  }
134  $this->name = (string) $data;
135  }
136 
137  return $this->name;
138  }
139 
146  public function getLabel()
147  {
148  if (is_null($this->label)) {
150  $data = $this->raw(self::FIELD_LABEL);
151  if (is_null($data)) {
152  return null;
153  }
154 
155  $this->label = LocalizedStringModel::of($data);
156  }
157 
158  return $this->label;
159  }
160 
167  public function getIsRequired()
168  {
169  if (is_null($this->isRequired)) {
171  $data = $this->raw(self::FIELD_IS_REQUIRED);
172  if (is_null($data)) {
173  return null;
174  }
175  $this->isRequired = (bool) $data;
176  }
177 
178  return $this->isRequired;
179  }
180 
187  public function getAttributeConstraint()
188  {
189  if (is_null($this->attributeConstraint)) {
191  $data = $this->raw(self::FIELD_ATTRIBUTE_CONSTRAINT);
192  if (is_null($data)) {
193  return null;
194  }
195  $this->attributeConstraint = (string) $data;
196  }
197 
199  }
200 
207  public function getInputTip()
208  {
209  if (is_null($this->inputTip)) {
211  $data = $this->raw(self::FIELD_INPUT_TIP);
212  if (is_null($data)) {
213  return null;
214  }
215 
216  $this->inputTip = LocalizedStringModel::of($data);
217  }
218 
219  return $this->inputTip;
220  }
221 
228  public function getInputHint()
229  {
230  if (is_null($this->inputHint)) {
232  $data = $this->raw(self::FIELD_INPUT_HINT);
233  if (is_null($data)) {
234  return null;
235  }
236  $this->inputHint = (string) $data;
237  }
238 
239  return $this->inputHint;
240  }
241 
252  public function getIsSearchable()
253  {
254  if (is_null($this->isSearchable)) {
256  $data = $this->raw(self::FIELD_IS_SEARCHABLE);
257  if (is_null($data)) {
258  return null;
259  }
260  $this->isSearchable = (bool) $data;
261  }
262 
263  return $this->isSearchable;
264  }
265 
266 
270  public function setType(?AttributeType $type): void
271  {
272  $this->type = $type;
273  }
274 
278  public function setName(?string $name): void
279  {
280  $this->name = $name;
281  }
282 
286  public function setLabel(?LocalizedString $label): void
287  {
288  $this->label = $label;
289  }
290 
294  public function setIsRequired(?bool $isRequired): void
295  {
296  $this->isRequired = $isRequired;
297  }
298 
302  public function setAttributeConstraint(?string $attributeConstraint): void
303  {
304  $this->attributeConstraint = $attributeConstraint;
305  }
306 
310  public function setInputTip(?LocalizedString $inputTip): void
311  {
312  $this->inputTip = $inputTip;
313  }
314 
318  public function setInputHint(?string $inputHint): void
319  {
320  $this->inputHint = $inputHint;
321  }
322 
326  public function setIsSearchable(?bool $isSearchable): void
327  {
328  $this->isSearchable = $isSearchable;
329  }
330 }
__construct(?AttributeType $type=null, ?string $name=null, ?LocalizedString $label=null, ?bool $isRequired=null, ?string $attributeConstraint=null, ?LocalizedString $inputTip=null, ?string $inputHint=null, ?bool $isSearchable=null)
static of($data=null)
Definition: MapperMap.php:45