Skip to content

Commit

Permalink
function array_key_first used instead of accessing 0 index, index key…
Browse files Browse the repository at this point in the history
… could be anything
  • Loading branch information
dineshsailor committed Mar 5, 2021
1 parent 52ecddd commit 74277f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/QueryGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class QueryGenerator
*/
public function generate($table, $rows, array $exclude = [])
{
$columns = array_keys($rows[0]);
$columns = array_keys($rows[array_key_first($rows)]);
$columnsString = implode('`,`', $columns);
$values = $this->buildSQLValuesStringFrom($rows);
$updates = $this->buildSQLUpdatesStringFrom($columns, $exclude);
Expand Down

0 comments on commit 74277f3

Please sign in to comment.