From b294d0fbde476503548fedebe7965ebc6ece478e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 27 Apr 2021 18:57:25 +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/ActiveRecord.php | 8 +++----- Database/Base/BaseActiveRecord.php | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Database/ActiveRecord.php b/Database/ActiveRecord.php index 18c55f35..815e2fae 100644 --- a/Database/ActiveRecord.php +++ b/Database/ActiveRecord.php @@ -168,14 +168,12 @@ class ActiveRecord extends BaseActiveRecord * @return static * @throws Exception */ - #[Pure] private static function getModelClass(): static + private static function getModelClass(): static { - return new static(); - $className = get_called_class(); /** @var Channel $channel */ $channel = Snowflake::app()->get('channel'); - return $channel->pop($className, function () use ($className) { - return new $className(); + return $channel->pop(static::class, function () { + return new static(); }); } diff --git a/Database/Base/BaseActiveRecord.php b/Database/Base/BaseActiveRecord.php index ca436fe0..34b8d796 100644 --- a/Database/Base/BaseActiveRecord.php +++ b/Database/Base/BaseActiveRecord.php @@ -362,6 +362,7 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess /** * @return array + * @throws Exception */ public function getAttributes(): array {