From d21bc528559c23bfea3b026542ae795bde004290 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 25 Apr 2016 14:11:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9BRelation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/model/Relation.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/library/think/model/Relation.php b/library/think/model/Relation.php index 9fc23218..b17d3e75 100644 --- a/library/think/model/Relation.php +++ b/library/think/model/Relation.php @@ -75,19 +75,9 @@ class Relation switch ($this->type) { case self::HAS_ONE: $result = $relation->where($foreignKey, $this->parent->$localKey)->find(); - if (false === $result) { - $class = $this->model; - $result = new $class; - $result->$foreignKey = $this->parent->$localKey; - } break; case self::BELONGS_TO: $result = $relation->where($localKey, $this->parent->$foreignKey)->find(); - if (false === $result) { - $class = $this->model; - $result = new $class; - $result->$localKey = $this->parent->$foreignKey; - } break; case self::HAS_MANY: $result = $relation->where($foreignKey, $this->parent->$localKey)->select();