Skip to content

Commit

Permalink
Improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed May 28, 2024
1 parent a10a84c commit 675d424
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/AbstractActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand All @@ -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 = [];
Expand Down

0 comments on commit 675d424

Please sign in to comment.