From b70a779e6d2708b39320ce5a393d4df3dcd53510 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Fri, 29 Dec 2023 13:12:13 +0700 Subject: [PATCH] Revert partially --- src/BaseActiveRecord.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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