diff --git a/src/BaseActiveRecord.php b/src/BaseActiveRecord.php index 7e7e2a91b..cd2aed1c9 100644 --- a/src/BaseActiveRecord.php +++ b/src/BaseActiveRecord.php @@ -136,6 +136,8 @@ public function getAttribute(string $name): mixed public function getAttributes(array $names = null, array $except = []): array { + $values = []; + if ($names === null) { $names = $this->attributes(); } @@ -144,7 +146,11 @@ public function getAttributes(array $names = null, array $except = []): array $names = array_diff($names, $except); } - return array_combine($names, array_map([$this, 'getAttribute'], $names)); + foreach ($names as $name) { + $values[$name] = $this->$name; + } + + return $values; } public function getIsNewRecord(): bool