modify
This commit is contained in:
@@ -580,7 +580,7 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
||||
foreach ($this->_attributes as $key => $val) {
|
||||
$oldValue = $this->_oldAttributes[$key] ?? null;
|
||||
if ($val !== $oldValue) {
|
||||
$_tmp[$key] = $columns->encode($val, $columns->clean($format[$key]));
|
||||
$_tmp[$key] = $this->toFormat($columns, $format, $key, $val);
|
||||
} else {
|
||||
$condition[$key] = $val;
|
||||
}
|
||||
@@ -589,6 +589,22 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $columns
|
||||
* @param $format
|
||||
* @param $key
|
||||
* @param $value
|
||||
* @return mixed
|
||||
*/
|
||||
public function toFormat($columns, $format, $key, $value)
|
||||
{
|
||||
if (isset($format[$key])) {
|
||||
return $columns->encode($value, $columns->clean($format[$key]));
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $name
|
||||
* @param $value
|
||||
|
||||
Reference in New Issue
Block a user