commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
QuoteRequestUpdateActionModel.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 'changeCustomer' => QuoteRequestChangeCustomerActionModel::class,
35 'changeQuoteRequestState' => QuoteRequestChangeQuoteRequestStateActionModel::class,
36 'setCustomField' => QuoteRequestSetCustomFieldActionModel::class,
37 'setCustomType' => QuoteRequestSetCustomTypeActionModel::class,
38 'transitionState' => QuoteRequestTransitionStateActionModel::class,
39 ];
40
44 public function __construct(
45 ?string $action = null
46 ) {
47 $this->action = $action;
48 }
49
54 public function getAction()
55 {
56 if (is_null($this->action)) {
58 $data = $this->raw(self::FIELD_ACTION);
59 if (is_null($data)) {
60 return null;
61 }
62 $this->action = (string) $data;
63 }
64
65 return $this->action;
66 }
67
68
69
70
71
76 public static function resolveDiscriminatorClass($value): string
77 {
79 if (is_object($value) && isset($value->$fieldName)) {
81 $discriminatorValue = $value->$fieldName;
82 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
83 return self::$discriminatorClasses[$discriminatorValue];
84 }
85 }
86 if (is_array($value) && isset($value[$fieldName])) {
88 $discriminatorValue = $value[$fieldName];
89 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
90 return self::$discriminatorClasses[$discriminatorValue];
91 }
92 }
93
95 $type = QuoteRequestUpdateActionModel::class;
96 return $type;
97 }
98}