改进关联模型

This commit is contained in:
thinkphp
2017-04-01 16:13:44 +08:00
parent 2ebf07ba16
commit d3be47e269
7 changed files with 39 additions and 13 deletions

View File

@@ -56,7 +56,10 @@ class MorphOne extends Relation
if ($closure) {
call_user_func_array($closure, [ & $this->query]);
}
return $this->relation($subRelation)->find();
$relationModel = $this->relation($subRelation)->find();
$relationModel->setParent(clone $this->parent);
return $relationModel;
}
/**