mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进追加关联模型属性的判断
This commit is contained in:
@@ -516,9 +516,13 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
if ($model instanceof Model) {
|
if ($model instanceof Model) {
|
||||||
foreach ($append as $key => $attr) {
|
foreach ($append as $key => $attr) {
|
||||||
$key = is_numeric($key) ? $attr : $key;
|
$key = is_numeric($key) ? $attr : $key;
|
||||||
|
if ($this->__isset($key)) {
|
||||||
|
throw new Exception('bind attr has exists:' . $key);
|
||||||
|
} else {
|
||||||
$this->setAttr($key, $model->$attr);
|
$this->setAttr($key, $model->$attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user