commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ChannelUpdateActionModel.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 'addRoles' => ChannelAddRolesActionModel::class,
35 'changeDescription' => ChannelChangeDescriptionActionModel::class,
36 'changeKey' => ChannelChangeKeyActionModel::class,
37 'changeName' => ChannelChangeNameActionModel::class,
38 'removeRoles' => ChannelRemoveRolesActionModel::class,
39 'setAddress' => ChannelSetAddressActionModel::class,
40 'setAddressCustomField' => ChannelSetAddressCustomFieldActionModel::class,
41 'setAddressCustomType' => ChannelSetAddressCustomTypeActionModel::class,
42 'setCustomField' => ChannelSetCustomFieldActionModel::class,
43 'setCustomType' => ChannelSetCustomTypeActionModel::class,
44 'setGeoLocation' => ChannelSetGeoLocationActionModel::class,
45 'setRoles' => ChannelSetRolesActionModel::class,
46 ];
47
51 public function __construct(
52 ?string $action = null
53 ) {
54 $this->action = $action;
55 }
56
61 public function getAction()
62 {
63 if (is_null($this->action)) {
65 $data = $this->raw(self::FIELD_ACTION);
66 if (is_null($data)) {
67 return null;
68 }
69 $this->action = (string) $data;
70 }
71
72 return $this->action;
73 }
74
75
76
77
78
83 public static function resolveDiscriminatorClass($value): string
84 {
86 if (is_object($value) && isset($value->$fieldName)) {
88 $discriminatorValue = $value->$fieldName;
89 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
90 return self::$discriminatorClasses[$discriminatorValue];
91 }
92 }
93 if (is_array($value) && isset($value[$fieldName])) {
95 $discriminatorValue = $value[$fieldName];
96 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
97 return self::$discriminatorClasses[$discriminatorValue];
98 }
99 }
100
102 $type = ChannelUpdateActionModel::class;
103 return $type;
104 }
105}