33 private static $discriminatorClasses = [
34 'customLineItems' => CartDiscountCustomLineItemsTargetModel::class,
35 'lineItems' => CartDiscountLineItemsTargetModel::class,
36 'multiBuyCustomLineItems' => MultiBuyCustomLineItemsTargetModel::class,
37 'multiBuyLineItems' => MultiBuyLineItemsTargetModel::class,
38 'pattern' => CartDiscountPatternTargetModel::class,
39 'shipping' => CartDiscountShippingCostTargetModel::class,
40 'totalPrice' => CartDiscountTotalPriceTargetModel::class,
58 if (is_null($this->type)) {
60 $data = $this->
raw(self::FIELD_TYPE);
64 $this->type = (string) $data;
81 if (is_object($value) && isset($value->$fieldName)) {
83 $discriminatorValue = $value->$fieldName;
84 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
85 return self::$discriminatorClasses[$discriminatorValue];
88 if (is_array($value) && isset($value[$fieldName])) {
90 $discriminatorValue = $value[$fieldName];
91 if (isset(self::$discriminatorClasses[$discriminatorValue])) {
92 return self::$discriminatorClasses[$discriminatorValue];
97 $type = CartDiscountTargetModel::class;