From c718e852dda6acf14e1865718cb3714f287101e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Thu, 17 Aug 2023 17:24:46 +0800 Subject: [PATCH] qqq --- Base/Model.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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]; }