From d85579faf8bfd49e22579de1dba98e4548bfc85e Mon Sep 17 00:00:00 2001 From: thinkphp Date: Thu, 23 Feb 2017 17:43:29 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E4=B8=80=E5=AF=B9=E4=B8=80?= =?UTF-8?q?=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/think/model/relation/MorphTo.php | 10 ++++++++++ library/think/model/relation/OneToOne.php | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/library/think/model/relation/MorphTo.php b/library/think/model/relation/MorphTo.php index 6c31a752..5fafd47a 100644 --- a/library/think/model/relation/MorphTo.php +++ b/library/think/model/relation/MorphTo.php @@ -114,6 +114,16 @@ class MorphTo extends Relation return $this; } + /** + * 移除关联查询参数 + * @access public + * @return $this + */ + public function removeOption() + { + return $this; + } + /** * 预载入关联查询 * @access public diff --git a/library/think/model/relation/OneToOne.php b/library/think/model/relation/OneToOne.php index c64dfcbb..8b602d59 100644 --- a/library/think/model/relation/OneToOne.php +++ b/library/think/model/relation/OneToOne.php @@ -194,7 +194,9 @@ abstract class OneToOne extends Relation */ public function getEagerlyType() { - $this->removeOption(); + if (0 == $this->eagerlyType) { + $this->removeOption(); + } return $this->eagerlyType; }