diff --git a/Base/Model.php b/Base/Model.php index d99ec79..1e6e007 100644 --- a/Base/Model.php +++ b/Base/Model.php @@ -508,13 +508,16 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T /** * @return array + * @throws Exception */ private function diff(): array { $changes = \array_diff_assoc($this->_attributes, $this->_oldAttributes); - - $condition = \array_intersect_assoc($this->_oldAttributes, $this->_attributes); - + if ($this->hasPrimaryValue()) { + $condition = [$this->getPrimary() => $this->getPrimaryValue()]; + } else { + $condition = \array_intersect_assoc($this->_oldAttributes, $this->_attributes); + } return [$changes, $condition]; }