This commit is contained in:
2023-08-17 17:30:53 +08:00
parent c718e852dd
commit bbd4d7b353
+2 -2
View File
@@ -513,8 +513,8 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
private function diff(): array private function diff(): array
{ {
$changes = \array_diff_assoc($this->_attributes, $this->_oldAttributes); $changes = \array_diff_assoc($this->_attributes, $this->_oldAttributes);
if ($this->hasPrimaryValue()) { if ($this->hasPrimary()) {
$condition = [$this->getPrimary() => $this->getPrimaryValue()]; $condition = [$this->getPrimary() => $this->_oldAttributes[$this->getPrimary()]];
} else { } else {
$condition = \array_intersect_assoc($this->_oldAttributes, $this->_attributes); $condition = \array_intersect_assoc($this->_oldAttributes, $this->_attributes);
} }