return;
case 'customerGroup':
if (isset($data['discounts'
])) { if (!
$model instanceof CustomerGroup
) { throw new RuntimeException(sprintf('Model object is not an instance of expected class "%s"', CustomerGroup::
class));
} $model->
getDiscounts()->
clear();
$manager->
flush();
$discounts =
[];
foreach ($data['discounts'
] as $discountData) { $discount =
new Discount();
$discount->
setDiscount($discountData['discount'
]);
$discount->
setValue($discountData['value'
]);
$discount->
setGroup($model);
$discounts[] =
$discount;
} $data['discounts'
] =
$discounts;
} if (empty($data['mode'
])) { $data['discount'
] = 0;
}