commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ProductSelectionDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
19 use stdClass;
20 
25 {
30  protected $key;
31 
36  protected $name;
37 
42  protected $custom;
43 
48  protected $mode;
49 
50 
54  public function __construct(
55  ?string $key = null,
56  ?LocalizedString $name = null,
57  ?CustomFieldsDraft $custom = null,
58  ?string $mode = null
59  ) {
60  $this->key = $key;
61  $this->name = $name;
62  $this->custom = $custom;
63  $this->mode = $mode;
64  }
65 
72  public function getKey()
73  {
74  if (is_null($this->key)) {
76  $data = $this->raw(self::FIELD_KEY);
77  if (is_null($data)) {
78  return null;
79  }
80  $this->key = (string) $data;
81  }
82 
83  return $this->key;
84  }
85 
92  public function getName()
93  {
94  if (is_null($this->name)) {
96  $data = $this->raw(self::FIELD_NAME);
97  if (is_null($data)) {
98  return null;
99  }
100 
101  $this->name = LocalizedStringModel::of($data);
102  }
103 
104  return $this->name;
105  }
106 
113  public function getCustom()
114  {
115  if (is_null($this->custom)) {
117  $data = $this->raw(self::FIELD_CUSTOM);
118  if (is_null($data)) {
119  return null;
120  }
121 
122  $this->custom = CustomFieldsDraftModel::of($data);
123  }
124 
125  return $this->custom;
126  }
127 
134  public function getMode()
135  {
136  if (is_null($this->mode)) {
138  $data = $this->raw(self::FIELD_MODE);
139  if (is_null($data)) {
140  return null;
141  }
142  $this->mode = (string) $data;
143  }
144 
145  return $this->mode;
146  }
147 
148 
152  public function setKey(?string $key): void
153  {
154  $this->key = $key;
155  }
156 
160  public function setName(?LocalizedString $name): void
161  {
162  $this->name = $name;
163  }
164 
168  public function setCustom(?CustomFieldsDraft $custom): void
169  {
170  $this->custom = $custom;
171  }
172 
176  public function setMode(?string $mode): void
177  {
178  $this->mode = $mode;
179  }
180 }
__construct(?string $key=null, ?LocalizedString $name=null, ?CustomFieldsDraft $custom=null, ?string $mode=null)
static of($data=null)
Definition: MapperMap.php:45