commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
StoreUpdateActionModel.php
1<?php
2
3declare(strict_types=1);
10
15use stdClass;
16
21{
22 public const DISCRIMINATOR_VALUE = '';
27 protected $action;
28
33 private static $discriminatorClasses = [
34 'addCountry' => StoreAddCountryActionModel::class,
35 'addDistributionChannel' => StoreAddDistributionChannelActionModel::class,
36 'addProductSelection' => StoreAddProductSelectionActionModel::class,
37 'addSupplyChannel' => StoreAddSupplyChannelActionModel::class,
38 'changeProductSelectionActive' => StoreChangeProductSelectionActionModel::class,
39 'removeCountry' => StoreRemoveCountryActionModel::class,
40 'removeDistributionChannel' => StoreRemoveDistributionChannelActionModel::class,
41 'removeProductSelection' => StoreRemoveProductSelectionActionModel::class,
42 'removeSupplyChannel' => StoreRemoveSupplyChannelActionModel::class,
43 'setCountries' => StoreSetCountriesActionModel::class,
44 'setCustomField' => StoreSetCustomFieldActionModel::class,
45 'setCustomType' => StoreSetCustomTypeActionModel::class,
46 'setDistributionChannels' => StoreSetDistributionChannelsActionModel::class,
47 'setLanguages' => StoreSetLanguagesActionModel::class,
48 'setName' => StoreSetNameActionModel::class,
49 'setProductSelections' => StoreSetProductSelectionsActionModel::class,
50 'setSupplyChannels' => StoreSetSupplyChannelsActionModel::class,
51 ];
52
56 public function __construct(
57 ?string $action = null
58 ) {
59 $this->action = $action;
60 }
61
66 public function getAction()
67 {
68 if (is_null($this->action)) {
70 $data = $this->raw(self::FIELD_ACTION);
71 if (is_null($data)) {
72 return null;
73 }
74 $this->action = (string) $data;
75 }
76
77 return $this->action;
78 }
79
80
81
82
83
88 public static function resolveDiscriminatorClass($value): string
89 {
91 if (is_object($value) && isset($value->$fieldName)) {
93 $discriminatorValue = $value->$fieldName;
94 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
95 return self::$discriminatorClasses[$discriminatorValue];
96 }
97 }
98 if (is_array($value) && isset($value[$fieldName])) {
100 $discriminatorValue = $value[$fieldName];
101 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
102 return self::$discriminatorClasses[$discriminatorValue];
103 }
104 }
105
107 $type = StoreUpdateActionModel::class;
108 return $type;
109 }
110}