mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
改进
This commit is contained in:
@@ -219,10 +219,11 @@ abstract class OneToOne extends Relation
|
|||||||
protected function bindAttr($model, &$result, $bindAttr)
|
protected function bindAttr($model, &$result, $bindAttr)
|
||||||
{
|
{
|
||||||
foreach ($bindAttr as $key => $attr) {
|
foreach ($bindAttr as $key => $attr) {
|
||||||
if (!isset($result->$attr)) {
|
$key = is_numeric($key) ? $attr : $key;
|
||||||
$result->setAttr(is_numeric($key) ? $attr : $key, $model->$attr);
|
if (isset($result->$key)) {
|
||||||
|
throw new Exception('bind attr has exists:' . $key);
|
||||||
} else {
|
} else {
|
||||||
throw new Exception('bind attr has exists:' . $attr);
|
$result->setAttr($key, $model->$attr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user