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 'setInventoryLimits' => InventoryEntrySetInventoryLimitsActionModel::class,
41 'setKey' => InventoryEntrySetKeyActionModel::class,
42 'setReorderPoint' => InventoryEntrySetReorderPointActionModel::class,
43 'setReservationExpirationInMinutes' => InventoryEntrySetReservationExpirationInMinutesActionModel::class,
44 'setRestockableInDays' => InventoryEntrySetRestockableInDaysActionModel::class,
45 'setSafetyStock' => InventoryEntrySetSafetyStockActionModel::class,
46 'setSupplyChannel' => InventoryEntrySetSupplyChannelActionModel::class,
47 ];
48
52 public function __construct(
53 ?string $action = null
54 ) {
55 $this->action = $action;
56 }
57
62 public function getAction()
63 {
64 if (is_null($this->action)) {
66 $data = $this->raw(self::FIELD_ACTION);
67 if (is_null($data)) {
68 return null;
69 }
70 $this->action = (string) $data;
71 }
72
73 return $this->action;
74 }
75
76
77
78
79
84 public static function resolveDiscriminatorClass($value): string
85 {
87 if (is_object($value) && isset($value->$fieldName)) {
89 $discriminatorValue = $value->$fieldName;
90 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
91 return self::$discriminatorClasses[$discriminatorValue];
92 }
93 }
94 if (is_array($value) && isset($value[$fieldName])) {
96 $discriminatorValue = $value[$fieldName];
97 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
98 return self::$discriminatorClasses[$discriminatorValue];
99 }
100 }
101
103 $type = InventoryEntryUpdateActionModel::class;
104 return $type;
105 }
106}
const DISCRIMINATOR_VALUE
$action
__construct(?string $action=null)
static resolveDiscriminatorClass($value)
getAction()
const DISCRIMINATOR_FIELD