mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
规范预载入方法的调用 如果调用user_profile 预载入会自动对应 userProfile关联方法
This commit is contained in:
@@ -1245,6 +1245,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
if (strpos($relation, '.')) {
|
if (strpos($relation, '.')) {
|
||||||
list($relation, $subRelation) = explode('.', $relation);
|
list($relation, $subRelation) = explode('.', $relation);
|
||||||
}
|
}
|
||||||
|
$relation = Loader::parseName($relation, 1);
|
||||||
$this->$relation()->eagerlyResultSet($resultSet, $relation, $subRelation, $closure, $class);
|
$this->$relation()->eagerlyResultSet($resultSet, $relation, $subRelation, $closure, $class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1271,6 +1272,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
|||||||
if (strpos($relation, '.')) {
|
if (strpos($relation, '.')) {
|
||||||
list($relation, $subRelation) = explode('.', $relation);
|
list($relation, $subRelation) = explode('.', $relation);
|
||||||
}
|
}
|
||||||
|
$relation = Loader::parseName($relation, 1);
|
||||||
$this->$relation()->eagerlyResult($result, $relation, $subRelation, $closure, $class);
|
$this->$relation()->eagerlyResult($result, $relation, $subRelation, $closure, $class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1653,7 +1653,8 @@ class Query
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** @var Relation $model */
|
/** @var Relation $model */
|
||||||
$model = $class->$relation();
|
$relation = Loader::parseName($relation, 1);
|
||||||
|
$model = $class->$relation();
|
||||||
if ($model instanceof HasOne || $model instanceof BelongsTo) {
|
if ($model instanceof HasOne || $model instanceof BelongsTo) {
|
||||||
$model->eagerly($this, $relation, $subRelation, $closure, $first);
|
$model->eagerly($this, $relation, $subRelation, $closure, $first);
|
||||||
$first = false;
|
$first = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user