30 lines
882 B
PHP
30 lines
882 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
class BankProgramBuilder implements ModelBuilder
|
||
|
|
{
|
||
|
|
public function getModel(array $data)
|
||
|
|
{
|
||
|
|
assert('!empty($data)');
|
||
|
|
assert('!empty($data["id"])');
|
||
|
|
$id = (string)$data['id'];
|
||
|
|
$model = BankProgram::findOne($id) ?: new BankProgram;
|
||
|
|
|
||
|
|
$model->id = $id;
|
||
|
|
$model->name = $data['name'];
|
||
|
|
$model->first_pay_percent_max = Convertor::strToFloat($data['firstpaypercentmax']);
|
||
|
|
$model->first_pay_percent_min = Convertor::strToFloat($data['firstpaypercentmin']);
|
||
|
|
$model->credit_sum_min = (int)$data['creditsummin'];
|
||
|
|
$model->credit_sum_max = (int)$data['creditsummax'];
|
||
|
|
$model->review_period = (int)$data['reviewperiod'];
|
||
|
|
$model->bank_id = (int)$data['bankid'];
|
||
|
|
|
||
|
|
return $model;
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getModelClassName()
|
||
|
|
{
|
||
|
|
return BankProgram::className();
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
}
|