mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
修正模型(Model)属性获取值时与Model类的方法冲突BUG fix #105
This commit is contained in:
@@ -292,11 +292,11 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
// 检测属性获取器
|
// 检测属性获取器
|
||||||
$method = 'get' . Loader::parseName($name, 1) . 'Attr';
|
$method = 'get' . Loader::parseName($name, 1) . 'Attr';
|
||||||
if (method_exists($this, $method)) {
|
if (method_exists($this, $method)) {
|
||||||
return $this->$method($value, $this->data);
|
$value = $this->$method($value, $this->data);
|
||||||
} elseif (!is_null($value) && isset($this->type[$name])) {
|
} elseif (!is_null($value) && isset($this->type[$name])) {
|
||||||
// 类型转换
|
// 类型转换
|
||||||
$value = $this->readTransform($value, $this->type[$name]);
|
$value = $this->readTransform($value, $this->type[$name]);
|
||||||
} elseif (is_null($value) && method_exists($this, $name)) {
|
} elseif (is_null($value) && !isset($this->fieldType[$name]) && method_exists($this, $name)) {
|
||||||
// 获取关联数据
|
// 获取关联数据
|
||||||
$value = $this->relation()->getRelation($name);
|
$value = $this->relation()->getRelation($name);
|
||||||
// 保存关联对象值
|
// 保存关联对象值
|
||||||
|
|||||||
Reference in New Issue
Block a user