From 7dd99877c04d858cb206b53f9eeea62707c3e95f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 19 Jan 2021 19:18:55 +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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Database/ActiveRecord.php b/Database/ActiveRecord.php index 63a6ddd3..77e7589d 100644 --- a/Database/ActiveRecord.php +++ b/Database/ActiveRecord.php @@ -10,6 +10,7 @@ declare(strict_types=1); namespace Database; +use Annotation\Model\Get; use Exception; use Database\Base\BaseActiveRecord; use Snowflake\Core\ArrayAccess; @@ -316,10 +317,14 @@ class ActiveRecord extends BaseActiveRecord $data = $this->_attributes; foreach ($callback as $key => $item) { foreach ($item['attributes'] as $attribute) { + if (!($attribute instanceof Get)) { + continue; + } + $name = $attribute->name; - $result = call_user_func($item['handler'], $data[$attribute]); + $result = call_user_func($item['handler'], $data[$name]); - $data[$attribute] = $result; + $data[$name] = $result; } }