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