From dab9fae0f03ae3f5a8d5453eb5dade339c678f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Tue, 19 Jan 2021 19:09:30 +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 | 4 ++++ Database/Base/BaseActiveRecord.php | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Database/ActiveRecord.php b/Database/ActiveRecord.php index d571afd9..318040f8 100644 --- a/Database/ActiveRecord.php +++ b/Database/ActiveRecord.php @@ -311,6 +311,10 @@ class ActiveRecord extends BaseActiveRecord public function toArray(): array { $data = []; + $attributes = Snowflake::app()->getAttributes(); + $callback = $attributes->getByClass(static::class); + var_dump($callback); + foreach ($this->_attributes as $key => $val) { $data[$key] = $this->getAttribute($key); } diff --git a/Database/Base/BaseActiveRecord.php b/Database/Base/BaseActiveRecord.php index 509ed6da..d642826c 100644 --- a/Database/Base/BaseActiveRecord.php +++ b/Database/Base/BaseActiveRecord.php @@ -492,10 +492,6 @@ abstract class BaseActiveRecord extends Component implements IOrm, \ArrayAccess { $method = 'get' . ucfirst($name) . 'Attribute'; - $attributes = Snowflake::app()->getAttributes(); - $callback = $attributes->getByClass(static::class, $name); - var_dump($callback); - if (method_exists($this, $method)) { return $this->$method($this->_attributes[$name]); }