From 3f2eb9d8edb95eda6d316716f79bdbfcfe8e1f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 27 Apr 2021 19:03:05 +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 | 3 +-- Database/Base/BaseActiveRecord.php | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/Database/ActiveRecord.php b/Database/ActiveRecord.php index 815e2fae..c1d79098 100644 --- a/Database/ActiveRecord.php +++ b/Database/ActiveRecord.php @@ -13,7 +13,6 @@ namespace Database; use Database\Base\BaseActiveRecord; use Database\Traits\HasBase; use Exception; -use JetBrains\PhpStorm\Pure; use ReflectionException; use Snowflake\Channel; use Snowflake\Exception\NotFindClassException; @@ -305,7 +304,7 @@ class ActiveRecord extends BaseActiveRecord { $data = $this->_attributes; - $lists = $this->getAnnotation(self::GET); + $lists = Snowflake::getAnnotation()->getGets(static::class); foreach ($lists as $key => $item) { $data[$key] = $this->{$item}($data[$key] ?? null); } diff --git a/Database/Base/BaseActiveRecord.php b/Database/Base/BaseActiveRecord.php index 41fb90c1..4eaf9959 100644 --- a/Database/Base/BaseActiveRecord.php +++ b/Database/Base/BaseActiveRecord.php @@ -844,18 +844,13 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess { $value = $this->_attributes[$name] ?? null; $method = $this->_get_annotation($name, static::GET); - - - var_dump($method); if (!empty($method)) { return $this->{$method}($value); } - $relation = $this->_get_annotation($name, static::RELATE); if (empty($relation)) { return $this->_decode($name, $value); } - if (($value = $this->{$relation}(...[$value])) instanceof HasBase) { return $value->get(); }