From 4fc9b42540749b5f0eef78065b83b12740ca15a3 Mon Sep 17 00:00:00 2001 From: xl Date: Wed, 9 Oct 2024 16:01:22 +0800 Subject: [PATCH] eee --- Base/Model.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Base/Model.php b/Base/Model.php index 9c5801a..00ba8d8 100644 --- a/Base/Model.php +++ b/Base/Model.php @@ -442,10 +442,13 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, \ if ($lastId === false) { return false; } - if ($this->hasPrimary()) { - $this->_attributes[$this->getPrimary()] = $lastId; + if (!$this->hasPrimary()) { + return $this->refresh()->afterSave($this->_attributes, []); } - return $this; + + $this->_attributes[$this->getPrimary()] = $lastId; + + return $this->refresh()->afterSave($this->_attributes, [$this->getPrimary() => $lastId]); }