Skip to content

Commit

Permalink
[fix] Index mapping error key with join #864
Browse files Browse the repository at this point in the history
  • Loading branch information
catfan committed Aug 14, 2019
1 parent 25192cf commit cf25af9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Medoo.php
Original file line number Diff line number Diff line change
Expand Up @@ -1175,14 +1175,15 @@ protected function dataMap($data, $columns, $column_map, &$stack, $root, &$resul
if (count($columns_key) === 1 && is_array($columns[$columns_key[0]]))
{
$index_key = array_keys($columns)[0];
$data_key = preg_replace("/^[a-zA-Z0-9_]+\./i", "", $index_key);

$current_stack = [];

foreach ($data as $item)
{
$this->dataMap($data, $columns[ $index_key ], $column_map, $current_stack, false, $result);

$index = $data[ $index_key ];
$index = $data[ $data_key ];

$result[ $index ] = $current_stack;
}
Expand Down

0 comments on commit cf25af9

Please sign in to comment.