From c04bb1cd1e5432281faf61469d047277364bf41a Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 11 Dec 2016 17:36:35 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E8=8C=83=E9=A2=84=E8=BD=BD=E5=85=A5?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=9A=84=E8=B0=83=E7=94=A8=20=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E8=B0=83=E7=94=A8user=5Fprofile=20=E9=A2=84=E8=BD=BD?= =?UTF-8?q?=E5=85=A5=E4=BC=9A=E8=87=AA=E5=8A=A8=E5=AF=B9=E5=BA=94=20userPr?= =?UTF-8?q?ofile=E5=85=B3=E8=81=94=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 2 ++ library/think/db/Query.php | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/library/think/Model.php b/library/think/Model.php index 2b7f3ae3..52c003cc 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -1245,6 +1245,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess if (strpos($relation, '.')) { list($relation, $subRelation) = explode('.', $relation); } + $relation = Loader::parseName($relation, 1); $this->$relation()->eagerlyResultSet($resultSet, $relation, $subRelation, $closure, $class); } } @@ -1271,6 +1272,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess if (strpos($relation, '.')) { list($relation, $subRelation) = explode('.', $relation); } + $relation = Loader::parseName($relation, 1); $this->$relation()->eagerlyResult($result, $relation, $subRelation, $closure, $class); } } diff --git a/library/think/db/Query.php b/library/think/db/Query.php index dc854a6c..43a5b07c 100644 --- a/library/think/db/Query.php +++ b/library/think/db/Query.php @@ -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;