From 8f20d59ff8ec4c16de2917243e37829608f451aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 2 Sep 2022 16:39:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Base/Model.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Base/Model.php b/Base/Model.php index ea58a50..a0eedd1 100644 --- a/Base/Model.php +++ b/Base/Model.php @@ -802,7 +802,12 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T */ public function __set($name, $value): void { - $method = 'set' . ucfirst($name) . 'Attribute'; + $method = 'set' . ucfirst($name); + if (method_exists($this, $method)) { + $this->{$method}($value); + return; + } + $method = $method . 'Attribute'; if (method_exists($this, $method)) { $this->_attributes[$name] = $this->{$method}($value); } else {