3 declare(strict_types=1);
33 private static $discriminatorClasses = [
34 'addAsset' => ProductAddAssetActionModel::class,
35 'addExternalImage' => ProductAddExternalImageActionModel::class,
36 'addPrice' => ProductAddPriceActionModel::class,
37 'addToCategory' => ProductAddToCategoryActionModel::class,
38 'addVariant' => ProductAddVariantActionModel::class,
39 'changeAssetName' => ProductChangeAssetNameActionModel::class,
40 'changeAssetOrder' => ProductChangeAssetOrderActionModel::class,
41 'changeMasterVariant' => ProductChangeMasterVariantActionModel::class,
42 'changeName' => ProductChangeNameActionModel::class,
43 'changePrice' => ProductChangePriceActionModel::class,
44 'changeSlug' => ProductChangeSlugActionModel::class,
45 'legacySetSku' => ProductLegacySetSkuActionModel::class,
46 'moveImageToPosition' => ProductMoveImageToPositionActionModel::class,
47 'publish' => ProductPublishActionModel::class,
48 'removeAsset' => ProductRemoveAssetActionModel::class,
49 'removeFromCategory' => ProductRemoveFromCategoryActionModel::class,
50 'removeImage' => ProductRemoveImageActionModel::class,
51 'removePrice' => ProductRemovePriceActionModel::class,
52 'removeVariant' => ProductRemoveVariantActionModel::class,
53 'revertStagedChanges' => ProductRevertStagedChangesActionModel::class,
54 'revertStagedVariantChanges' => ProductRevertStagedVariantChangesActionModel::class,
55 'setAssetCustomField' => ProductSetAssetCustomFieldActionModel::class,
56 'setAssetCustomType' => ProductSetAssetCustomTypeActionModel::class,
57 'setAssetDescription' => ProductSetAssetDescriptionActionModel::class,
58 'setAssetKey' => ProductSetAssetKeyActionModel::class,
59 'setAssetSources' => ProductSetAssetSourcesActionModel::class,
60 'setAssetTags' => ProductSetAssetTagsActionModel::class,
61 'setAttribute' => ProductSetAttributeActionModel::class,
62 'setAttributeInAllVariants' => ProductSetAttributeInAllVariantsActionModel::class,
63 'setCategoryOrderHint' => ProductSetCategoryOrderHintActionModel::class,
64 'setDescription' => ProductSetDescriptionActionModel::class,
65 'setDiscountedPrice' => ProductSetDiscountedPriceActionModel::class,
66 'setImageLabel' => ProductSetImageLabelActionModel::class,
67 'setKey' => ProductSetKeyActionModel::class,
68 'setMetaDescription' => ProductSetMetaDescriptionActionModel::class,
69 'setMetaKeywords' => ProductSetMetaKeywordsActionModel::class,
70 'setMetaTitle' => ProductSetMetaTitleActionModel::class,
71 'setPriceKey' => ProductSetPriceKeyActionModel::class,
72 'setPriceMode' => ProductSetPriceModeActionModel::class,
73 'setPrices' => ProductSetPricesActionModel::class,
74 'setProductPriceCustomField' => ProductSetProductPriceCustomFieldActionModel::class,
75 'setProductPriceCustomType' => ProductSetProductPriceCustomTypeActionModel::class,
76 'setProductVariantKey' => ProductSetProductVariantKeyActionModel::class,
77 'setSearchKeywords' => ProductSetSearchKeywordsActionModel::class,
78 'setSku' => ProductSetSkuActionModel::class,
79 'setTaxCategory' => ProductSetTaxCategoryActionModel::class,
80 'transitionState' => ProductTransitionStateActionModel::class,
81 'unpublish' => ProductUnpublishActionModel::class,
99 if (is_null($this->action)) {
101 $data = $this->
raw(self::FIELD_ACTION);
102 if (is_null($data)) {
105 $this->action = (string) $data;
122 if (is_object($value) && isset($value->$fieldName)) {
124 $discriminatorValue = $value->$fieldName;
125 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
126 return self::$discriminatorClasses[$discriminatorValue];
129 if (is_array($value) && isset($value[$fieldName])) {
131 $discriminatorValue = $value[$fieldName];
132 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
133 return self::$discriminatorClasses[$discriminatorValue];
138 $type = ProductUpdateActionModel::class;