This commit is contained in:
2022-09-02 16:39:17 +08:00
parent e41d03ea27
commit 8f20d59ff8
+6 -1
View File
@@ -802,7 +802,12 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
*/ */
public function __set($name, $value): void 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)) { if (method_exists($this, $method)) {
$this->_attributes[$name] = $this->{$method}($value); $this->_attributes[$name] = $this->{$method}($value);
} else { } else {