规范预载入方法的调用 如果调用user_profile 预载入会自动对应 userProfile关联方法

This commit is contained in:
thinkphp
2016-12-11 17:36:35 +08:00
parent 63a3936eb9
commit c04bb1cd1e
2 changed files with 4 additions and 1 deletions

View File

@@ -1653,7 +1653,8 @@ class Query
}
/** @var Relation $model */
$model = $class->$relation();
$relation = Loader::parseName($relation, 1);
$model = $class->$relation();
if ($model instanceof HasOne || $model instanceof BelongsTo) {
$model->eagerly($this, $relation, $subRelation, $closure, $first);
$first = false;