commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
MyQuoteRequestUpdateActionModel.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  'cancelQuoteRequest' => MyQuoteRequestCancelActionModel::class,
35  ];
36 
40  public function __construct(
41  ?string $action = null
42  ) {
43  $this->action = $action;
44  }
45 
50  public function getAction()
51  {
52  if (is_null($this->action)) {
54  $data = $this->raw(self::FIELD_ACTION);
55  if (is_null($data)) {
56  return null;
57  }
58  $this->action = (string) $data;
59  }
60 
61  return $this->action;
62  }
63 
64 
65 
66 
67 
72  public static function resolveDiscriminatorClass($value): string
73  {
75  if (is_object($value) && isset($value->$fieldName)) {
77  $discriminatorValue = $value->$fieldName;
78  if (isset(self::$discriminatorClasses[$discriminatorValue])) {
79  return self::$discriminatorClasses[$discriminatorValue];
80  }
81  }
82  if (is_array($value) && isset($value[$fieldName])) {
84  $discriminatorValue = $value[$fieldName];
85  if (isset(self::$discriminatorClasses[$discriminatorValue])) {
86  return self::$discriminatorClasses[$discriminatorValue];
87  }
88  }
89 
91  $type = MyQuoteRequestUpdateActionModel::class;
92  return $type;
93  }
94 }