From 509eabe78eb816fff05902c53c263051a9b0b830 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Sat, 1 Apr 2023 15:58:17 +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 --- ActiveQuery.php | 6 ++---- Model.php | 3 --- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/ActiveQuery.php b/ActiveQuery.php index 1ca736e..ceb44d3 100644 --- a/ActiveQuery.php +++ b/ActiveQuery.php @@ -238,10 +238,8 @@ class ActiveQuery extends Component implements ISqlBuilder $this->getWith($this->modelClass); $collect = new Collection($this, $data, $this->modelClass); - if ($this->asArray) { - return $collect->toArray(); - } - return $collect; + + return $this->asArray ? $collect->toArray() : $collect; } /** diff --git a/Model.php b/Model.php index 25c7674..ef7896c 100644 --- a/Model.php +++ b/Model.php @@ -279,9 +279,6 @@ class Model extends Base\Model */ private function withRelates($relates): array { - if (!$this->hasWith()) { - return $relates; - } foreach ($this->getWith() as $val) { $relates[$val] = $this->withRelate($val); }