$model =
new $model();
} if (!
$model instanceof ModelEntity
) { throw new RuntimeException('Model object could not be created correctly'
);
} switch ($name) { case 'tax':
if (!
$model instanceof Tax
) { throw new RuntimeException(sprintf('Model object is not an instance of expected class "%s"', Tax::
class));
} $this->
saveTaxRules($data,
$model);
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 =
[];