改进一对一关联

This commit is contained in:
thinkphp
2018-03-02 15:46:44 +08:00
parent 748c060f01
commit 95e9d848f7
2 changed files with 6 additions and 1 deletions

View File

@@ -52,6 +52,7 @@ class BelongsTo extends OneToOne
call_user_func_array($closure, [ & $this->query]);
}
$relationModel = $this->query
->removeWhereField($this->localKey)
->where($this->localKey, $this->parent->$foreignKey)
->relation($subRelation)
->find();