From bfcdd5ce6a35209cd3d0f58c4d1ac8e6dccd8816 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Wed, 26 Apr 2017 17:58:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E5=85=B3=E8=81=94=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/Model.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/library/think/Model.php b/library/think/Model.php index 7281d9af..12948b6e 100644 --- a/library/think/Model.php +++ b/library/think/Model.php @@ -517,7 +517,6 @@ abstract class Model implements \JsonSerializable, \ArrayAccess } } elseif ($notFound) { $relation = $this->isRelationAttr($name); - $method = Loader::parseName($name, 1, false); if ($relation) { $modelRelation = $this->$relation(); // 不存在该字段 获取关联数据 @@ -537,7 +536,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess * @param Relation $modelRelation 模型关联对象 * @return mixed */ - protected function getRelationData($modelRelation) + protected function getRelationData(Relation $modelRelation) { if ($this->parent && get_class($this->parent) == $modelRelation->getModel()) { $value = $this->parent; @@ -1084,10 +1083,7 @@ abstract class Model implements \JsonSerializable, \ArrayAccess $relation = Loader::parseName($attr, 1, false); if (method_exists($this, $relation)) { - $reflect = new \ReflectionMethod($this, $relation); - if (0 == $reflect->getNumberOfParameters() && $this->$relation() instanceof Relation) { - return $relation; - } + return $relation; } return false;