mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
Model类增加setRelation方法和setAttr方法区分
This commit is contained in:
@@ -148,7 +148,7 @@ class BelongsTo extends OneToOne
|
||||
$this->bindAttr($relationModel, $result, $this->bindAttr);
|
||||
}
|
||||
// 设置关联属性
|
||||
$result->setAttr($attr, $relationModel);
|
||||
$result->setRelation($attr, $relationModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -180,7 +180,7 @@ class BelongsTo extends OneToOne
|
||||
$this->bindAttr($relationModel, $result, $this->bindAttr);
|
||||
}
|
||||
// 设置关联属性
|
||||
$result->setAttr(Loader::parseName($relation), $relationModel);
|
||||
$result->setRelation(Loader::parseName($relation), $relationModel);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,7 +197,7 @@ class BelongsTo extends OneToOne
|
||||
$this->parent->setAttr($foreignKey, $model->$pk);
|
||||
$this->parent->save();
|
||||
|
||||
return $this->parent->setAttr($this->relation, $model);
|
||||
return $this->parent->setRelation($this->relation, $model);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,6 +212,6 @@ class BelongsTo extends OneToOne
|
||||
$this->parent->setAttr($foreignKey, null);
|
||||
$this->parent->save();
|
||||
|
||||
return $this->parent->setAttr($this->relation, null);
|
||||
return $this->parent->setRelation($this->relation, null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user