From 5b3e2bb56996b3d4ee21efb4d1d2b9e61034b818 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Mon, 10 Apr 2023 17:53:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Base/Model.php | 2 +- Model.php | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Base/Model.php b/Base/Model.php index 62391e1..33486c4 100644 --- a/Base/Model.php +++ b/Base/Model.php @@ -676,7 +676,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T * @param $name * @return mixed|null */ - private function withRelate($name): mixed + protected function withRelate($name): mixed { $response = $this->{'get' . ucfirst($name)}(); if ($response instanceof HasBase) { diff --git a/Model.php b/Model.php index 32f6a17..cecd9f4 100644 --- a/Model.php +++ b/Model.php @@ -274,10 +274,7 @@ class Model extends Base\Model { $with = $this->getWith(); foreach ($with as $value) { - $join = $this->{'get' . ucfirst($value)}(); - if ($join instanceof HasBase) { - $join = $join->get(); - } + $join = $this->withRelate($value); if ($join instanceof Kiri\ToArray) { $join = $join->toArray(); }