Skip to content

Commit

Permalink
Fix according to type of $rows
Browse files Browse the repository at this point in the history
`array<array-key, array>`
  • Loading branch information
Tigrov committed Apr 15, 2024
1 parent 29a009d commit e54c7b0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Query/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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
Expand Down

0 comments on commit e54c7b0

Please sign in to comment.