3 declare(strict_types=1);
33 private static $discriminatorClasses = [
34 'customLineItems' => CartDiscountCustomLineItemsTargetModel::class,
35 'lineItems' => CartDiscountLineItemsTargetModel::class,
36 'multiBuyCustomLineItems' => MultiBuyCustomLineItemsTargetModel::class,
37 'multiBuyLineItems' => MultiBuyLineItemsTargetModel::class,
38 'shipping' => CartDiscountShippingCostTargetModel::class,
39 'totalPrice' => CartDiscountTotalPriceTargetModel::class,
57 if (is_null($this->type)) {
59 $data = $this->
raw(self::FIELD_TYPE);
63 $this->type = (string) $data;
80 if (is_object($value) && isset($value->$fieldName)) {
82 $discriminatorValue = $value->$fieldName;
83 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
84 return self::$discriminatorClasses[$discriminatorValue];
87 if (is_array($value) && isset($value[$fieldName])) {
89 $discriminatorValue = $value[$fieldName];
90 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
91 return self::$discriminatorClasses[$discriminatorValue];
96 $type = CartDiscountTargetModel::class;