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]); }