From 8bc34a4307fa27186c0e96a9b3de3cb23aa1ed46 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sun, 19 Mar 2023 12:51:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E5=85=B3=E8=81=94=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E8=8E=B7=E5=8F=96=E7=88=B6=E5=AF=B9=E8=B1=A1=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/model/concern/RelationShip.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/model/concern/RelationShip.php b/src/model/concern/RelationShip.php index 8e0d498e..37b8af87 100644 --- a/src/model/concern/RelationShip.php +++ b/src/model/concern/RelationShip.php @@ -735,7 +735,9 @@ protected function isRelationAttr(string $attr) protected function getRelationData(Relation $modelRelation) { if ($this->parent && !$modelRelation->isSelfRelation() - && get_class($this->parent) == get_class($modelRelation->getModel())) { + && get_class($this->parent) == get_class($modelRelation->getModel()) + && $modelRelation instanceof OneToOne + ) { return $this->parent; }