commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
StoreDraftModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
21 use stdClass;
22 
26 final class StoreDraftModel extends JsonObjectModel implements StoreDraft
27 {
32  protected $key;
33 
38  protected $name;
39 
44  protected $languages;
45 
50  protected $countries;
51 
57 
62  protected $supplyChannels;
63 
68  protected $productSelections;
69 
74  protected $custom;
75 
76 
80  public function __construct(
81  ?string $key = null,
82  ?LocalizedString $name = null,
83  ?array $languages = null,
89  ) {
90  $this->key = $key;
91  $this->name = $name;
92  $this->languages = $languages;
93  $this->countries = $countries;
94  $this->distributionChannels = $distributionChannels;
95  $this->supplyChannels = $supplyChannels;
96  $this->productSelections = $productSelections;
97  $this->custom = $custom;
98  }
99 
107  public function getKey()
108  {
109  if (is_null($this->key)) {
111  $data = $this->raw(self::FIELD_KEY);
112  if (is_null($data)) {
113  return null;
114  }
115  $this->key = (string) $data;
116  }
117 
118  return $this->key;
119  }
120 
127  public function getName()
128  {
129  if (is_null($this->name)) {
131  $data = $this->raw(self::FIELD_NAME);
132  if (is_null($data)) {
133  return null;
134  }
135 
136  $this->name = LocalizedStringModel::of($data);
137  }
138 
139  return $this->name;
140  }
141 
148  public function getLanguages()
149  {
150  if (is_null($this->languages)) {
152  $data = $this->raw(self::FIELD_LANGUAGES);
153  if (is_null($data)) {
154  return null;
155  }
156  $this->languages = $data;
157  }
158 
159  return $this->languages;
160  }
161 
168  public function getCountries()
169  {
170  if (is_null($this->countries)) {
172  $data = $this->raw(self::FIELD_COUNTRIES);
173  if (is_null($data)) {
174  return null;
175  }
176  $this->countries = StoreCountryCollection::fromArray($data);
177  }
178 
179  return $this->countries;
180  }
181 
188  public function getDistributionChannels()
189  {
190  if (is_null($this->distributionChannels)) {
192  $data = $this->raw(self::FIELD_DISTRIBUTION_CHANNELS);
193  if (is_null($data)) {
194  return null;
195  }
196  $this->distributionChannels = ChannelResourceIdentifierCollection::fromArray($data);
197  }
198 
200  }
201 
208  public function getSupplyChannels()
209  {
210  if (is_null($this->supplyChannels)) {
212  $data = $this->raw(self::FIELD_SUPPLY_CHANNELS);
213  if (is_null($data)) {
214  return null;
215  }
216  $this->supplyChannels = ChannelResourceIdentifierCollection::fromArray($data);
217  }
218 
219  return $this->supplyChannels;
220  }
221 
234  public function getProductSelections()
235  {
236  if (is_null($this->productSelections)) {
238  $data = $this->raw(self::FIELD_PRODUCT_SELECTIONS);
239  if (is_null($data)) {
240  return null;
241  }
242  $this->productSelections = ProductSelectionSettingDraftCollection::fromArray($data);
243  }
244 
246  }
247 
254  public function getCustom()
255  {
256  if (is_null($this->custom)) {
258  $data = $this->raw(self::FIELD_CUSTOM);
259  if (is_null($data)) {
260  return null;
261  }
262 
263  $this->custom = CustomFieldsDraftModel::of($data);
264  }
265 
266  return $this->custom;
267  }
268 
269 
273  public function setKey(?string $key): void
274  {
275  $this->key = $key;
276  }
277 
281  public function setName(?LocalizedString $name): void
282  {
283  $this->name = $name;
284  }
285 
289  public function setLanguages(?array $languages): void
290  {
291  $this->languages = $languages;
292  }
293 
298  {
299  $this->countries = $countries;
300  }
301 
306  {
307  $this->distributionChannels = $distributionChannels;
308  }
309 
314  {
315  $this->supplyChannels = $supplyChannels;
316  }
317 
322  {
323  $this->productSelections = $productSelections;
324  }
325 
329  public function setCustom(?CustomFieldsDraft $custom): void
330  {
331  $this->custom = $custom;
332  }
333 }
setCountries(?StoreCountryCollection $countries)
setDistributionChannels(?ChannelResourceIdentifierCollection $distributionChannels)
setSupplyChannels(?ChannelResourceIdentifierCollection $supplyChannels)
setProductSelections(?ProductSelectionSettingDraftCollection $productSelections)
__construct(?string $key=null, ?LocalizedString $name=null, ?array $languages=null, ?StoreCountryCollection $countries=null, ?ChannelResourceIdentifierCollection $distributionChannels=null, ?ChannelResourceIdentifierCollection $supplyChannels=null, ?ProductSelectionSettingDraftCollection $productSelections=null, ?CustomFieldsDraft $custom=null)
static of($data=null)
Definition: MapperMap.php:45