mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 07:32:48 +08:00
改进Model类setAttr方法
This commit is contained in:
@@ -292,7 +292,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 标记字段更改
|
// 标记字段更改
|
||||||
if (!isset($this->data[$name]) || (0 !== strcmp($this->data[$name], $value) && !in_array($name, $this->change))) {
|
if (isset($this->data[$name]) && is_scalar($this->data[$name]) && is_scalar($value) && 0 !== strcmp($this->data[$name], $value)) {
|
||||||
|
$this->change[] = $name;
|
||||||
|
} elseif (!isset($this->data[$name]) || $value != $this->data[$name]) {
|
||||||
$this->change[] = $name;
|
$this->change[] = $name;
|
||||||
}
|
}
|
||||||
// 设置数据对象属性
|
// 设置数据对象属性
|
||||||
|
|||||||
Reference in New Issue
Block a user