commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
ProjectUpdateActionModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
16 
21 {
22  public const DISCRIMINATOR_VALUE = '';
27  protected $action;
28 
33  private static $discriminatorClasses = [
34  'changeCartsConfiguration' => ProjectChangeCartsConfigurationActionModel::class,
35  'changeCountries' => ProjectChangeCountriesActionModel::class,
36  'changeCountryTaxRateFallbackEnabled' => ProjectChangeCountryTaxRateFallbackEnabledActionModel::class,
37  'changeCurrencies' => ProjectChangeCurrenciesActionModel::class,
38  'changeCustomerSearchStatus' => ProjectChangeCustomerSearchStatusActionModel::class,
39  'changeLanguages' => ProjectChangeLanguagesActionModel::class,
40  'changeMessagesConfiguration' => ProjectChangeMessagesConfigurationActionModel::class,
41  'changeMyBusinessUnitStatusOnCreation' => ProjectChangeBusinessUnitStatusOnCreationActionModel::class,
42  'changeName' => ProjectChangeNameActionModel::class,
43  'changeOrderSearchStatus' => ProjectChangeOrderSearchStatusActionModel::class,
44  'changeProductSearchIndexingEnabled' => ProjectChangeProductSearchIndexingEnabledActionModel::class,
45  'changeShoppingListsConfiguration' => ProjectChangeShoppingListsConfigurationActionModel::class,
46  'setExternalOAuth' => ProjectSetExternalOAuthActionModel::class,
47  'setMyBusinessUnitAssociateRoleOnCreation' => ProjectSetBusinessUnitAssociateRoleOnCreationActionModel::class,
48  'setShippingRateInputType' => ProjectSetShippingRateInputTypeActionModel::class,
49  ];
50 
54  public function __construct(
55  ?string $action = null
56  ) {
57  $this->action = $action;
58  }
59 
64  public function getAction()
65  {
66  if (is_null($this->action)) {
68  $data = $this->raw(self::FIELD_ACTION);
69  if (is_null($data)) {
70  return null;
71  }
72  $this->action = (string) $data;
73  }
74 
75  return $this->action;
76  }
77 
78 
79 
80 
81 
86  public static function resolveDiscriminatorClass($value): string
87  {
89  if (is_object($value) && isset($value->$fieldName)) {
91  $discriminatorValue = $value->$fieldName;
92  if (isset(self::$discriminatorClasses[$discriminatorValue])) {
93  return self::$discriminatorClasses[$discriminatorValue];
94  }
95  }
96  if (is_array($value) && isset($value[$fieldName])) {
98  $discriminatorValue = $value[$fieldName];
99  if (isset(self::$discriminatorClasses[$discriminatorValue])) {
100  return self::$discriminatorClasses[$discriminatorValue];
101  }
102  }
103 
105  $type = ProjectUpdateActionModel::class;
106  return $type;
107  }
108 }