From a40e57db50c10e84c475b4d65f7593f68852a5d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 22 Feb 2021 18:20:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Database/ActiveQuery.php | 10 +++++----- Database/Traits/QueryTrait.php | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Database/ActiveQuery.php b/Database/ActiveQuery.php index 0167073a..f21ffe0a 100644 --- a/Database/ActiveQuery.php +++ b/Database/ActiveQuery.php @@ -45,22 +45,22 @@ class ActiveQuery extends Component public array $attributes = []; - /** @var ActiveRecord */ - public ActiveRecord $modelClass; - /** * Comply constructor. * @param $model * @param array $config * @throws */ - public function __construct($model, $config = []) + public function __construct($model = null, $config = []) { + if (empty($model)) { + return parent::__construct($config); + } if (!is_object($model)) { $model = Snowflake::createObject($model); } $this->modelClass = $model; - parent::__construct($config); + return parent::__construct($config); } /** diff --git a/Database/Traits/QueryTrait.php b/Database/Traits/QueryTrait.php index 39a37b8f..7554c5ca 100644 --- a/Database/Traits/QueryTrait.php +++ b/Database/Traits/QueryTrait.php @@ -35,9 +35,9 @@ trait QueryTrait public bool $ifNotWhere = false; /** - * @var ActiveRecord + * @var ?ActiveRecord */ - public ActiveRecord $modelClass; + public ?ActiveRecord $modelClass; /** * clear