mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
改进Model类的setAttr方法
This commit is contained in:
@@ -343,14 +343,15 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
$method = 'set' . Loader::parseName($name, 1) . 'Attr';
|
||||
if (method_exists($this, $method)) {
|
||||
$value = $this->$method($value, array_merge($this->data, $data));
|
||||
}
|
||||
if ($this->isRelationAttr($name)) {
|
||||
$isRelationData = true;
|
||||
} elseif (isset($this->type[$name])) {
|
||||
// 类型转换
|
||||
$value = $this->writeTransform($value, $this->type[$name]);
|
||||
}
|
||||
|
||||
if ($this->isRelationAttr($name)) {
|
||||
$isRelationData = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 设置数据对象属性
|
||||
|
||||
Reference in New Issue
Block a user