commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
InventoryEntryUpdateActionModel.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 'addQuantity' => InventoryEntryAddQuantityActionModel::class,
35 'changeQuantity' => InventoryEntryChangeQuantityActionModel::class,
36 'removeQuantity' => InventoryEntryRemoveQuantityActionModel::class,
37 'setCustomField' => InventoryEntrySetCustomFieldActionModel::class,
38 'setCustomType' => InventoryEntrySetCustomTypeActionModel::class,
39 'setExpectedDelivery' => InventoryEntrySetExpectedDeliveryActionModel::class,
40 'setKey' => InventoryEntrySetKeyActionModel::class,
41 'setRestockableInDays' => InventoryEntrySetRestockableInDaysActionModel::class,
42 'setSupplyChannel' => InventoryEntrySetSupplyChannelActionModel::class,
43 ];
44
48 public function __construct(
49 ?string $action = null
50 ) {
51 $this->action = $action;
52 }
53
58 public function getAction()
59 {
60 if (is_null($this->action)) {
62 $data = $this->raw(self::FIELD_ACTION);
63 if (is_null($data)) {
64 return null;
65 }
66 $this->action = (string) $data;
67 }
68
69 return $this->action;
70 }
71
72
73
74
75
80 public static function resolveDiscriminatorClass($value): string
81 {
83 if (is_object($value) && isset($value->$fieldName)) {
85 $discriminatorValue = $value->$fieldName;
86 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
87 return self::$discriminatorClasses[$discriminatorValue];
88 }
89 }
90 if (is_array($value) && isset($value[$fieldName])) {
92 $discriminatorValue = $value[$fieldName];
93 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
94 return self::$discriminatorClasses[$discriminatorValue];
95 }
96 }
97
99 $type = InventoryEntryUpdateActionModel::class;
100 return $type;
101 }
102}
const DISCRIMINATOR_VALUE
$action
__construct(?string $action=null)
static resolveDiscriminatorClass($value)
getAction()
const DISCRIMINATOR_FIELD