This commit is contained in:
xl
2024-10-09 16:01:22 +08:00
parent e5453807f2
commit 4fc9b42540
+6 -3
View File
@@ -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]);
}