diff --git a/src/AbstractActiveRecord.php b/src/AbstractActiveRecord.php index a3a40cfbc..0be18c184 100644 --- a/src/AbstractActiveRecord.php +++ b/src/AbstractActiveRecord.php @@ -191,7 +191,7 @@ public function getOldPrimaryKey(bool $asArray = false): mixed } if ($asArray === false && count($keys) === 1) { - return $this->oldAttributes[reset($keys)] ?? null; + return $this->oldAttributes[$keys[0]] ?? null; } $values = []; @@ -208,7 +208,7 @@ public function getPrimaryKey(bool $asArray = false): mixed $keys = $this->primaryKey(); if ($asArray === false && count($keys) === 1) { - return $this->getAttribute(reset($keys)); + return $this->getAttribute($keys[0]); } $values = [];