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(); }