commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
OrderEditUpdateActionModel.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 'addStagedAction' => OrderEditAddStagedActionActionModel::class,
35 'setComment' => OrderEditSetCommentActionModel::class,
36 'setCustomField' => OrderEditSetCustomFieldActionModel::class,
37 'setCustomType' => OrderEditSetCustomTypeActionModel::class,
38 'setKey' => OrderEditSetKeyActionModel::class,
39 'setStagedActions' => OrderEditSetStagedActionsActionModel::class,
40 ];
41
45 public function __construct(
46 ?string $action = null
47 ) {
48 $this->action = $action;
49 }
50
55 public function getAction()
56 {
57 if (is_null($this->action)) {
59 $data = $this->raw(self::FIELD_ACTION);
60 if (is_null($data)) {
61 return null;
62 }
63 $this->action = (string) $data;
64 }
65
66 return $this->action;
67 }
68
69
70
71
72
77 public static function resolveDiscriminatorClass($value): string
78 {
80 if (is_object($value) && isset($value->$fieldName)) {
82 $discriminatorValue = $value->$fieldName;
83 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
84 return self::$discriminatorClasses[$discriminatorValue];
85 }
86 }
87 if (is_array($value) && isset($value[$fieldName])) {
89 $discriminatorValue = $value[$fieldName];
90 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
91 return self::$discriminatorClasses[$discriminatorValue];
92 }
93 }
94
96 $type = OrderEditUpdateActionModel::class;
97 return $type;
98 }
99}