From e54c7b006269e62310b7d643d7e21b4e9d3c8c22 Mon Sep 17 00:00:00 2001 From: Tigrov Date: Mon, 15 Apr 2024 18:14:06 +0700 Subject: [PATCH] Fix according to type of `$rows` `array` --- src/Query/Query.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Query/Query.php b/src/Query/Query.php index 16bd506eb..1a2857811 100644 --- a/src/Query/Query.php +++ b/src/Query/Query.php @@ -24,6 +24,7 @@ use function array_shift; use function array_unshift; use function count; +use function current; use function gettype; use function is_array; use function is_int; @@ -280,7 +281,7 @@ public function column(): array $column = substr($this->indexBy, $dotPos + 1); } - return array_column($rows, key($rows[0]), $column); + return array_column($rows, key(current($rows)), $column); } $rows = $this->createCommand()->queryAll(); @@ -289,7 +290,7 @@ public function column(): array return []; } - return array_combine(array_map($this->indexBy, $rows), array_column($rows, key($rows[0]))); + return array_combine(array_map($this->indexBy, $rows), array_column($rows, key(current($rows)))); } public function count(string $sql = '*'): int|string