28 lines
783 B
PHP
28 lines
783 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
class BankProgramRateBuilder implements ModelBuilder
|
||
|
|
{
|
||
|
|
public function getModel(array $data)
|
||
|
|
{
|
||
|
|
assert('!empty($data)');
|
||
|
|
assert('!empty($data["id"])');
|
||
|
|
$id = (string)$data['id'];
|
||
|
|
$model = BankProgramRate::findOne($id) ?: new BankProgramRate();
|
||
|
|
|
||
|
|
$model->id = $id;
|
||
|
|
$model->period_min = (int)$data['periodmin'];
|
||
|
|
$model->period_max = (int)$data['periodmax'];
|
||
|
|
$model->rate_percent = Convertor::strToFloat($data['ratepercent']);
|
||
|
|
$model->first_pay_percent = Convertor::strToFloat($data['firstpaypercent']);
|
||
|
|
$model->bank_program_id = (string)$data['bankprogramid'];
|
||
|
|
|
||
|
|
return $model;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getModelClassName()
|
||
|
|
{
|
||
|
|
return BankProgramRate::className();
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|