Skip to content

Commit

Permalink
Fix adding an array (do not cast int keys into strings)
Browse files Browse the repository at this point in the history
  • Loading branch information
makasim committed Feb 20, 2018
1 parent db3c7cc commit 8d61d69
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ public static function convertJsonPatchToMongoUpdate(array $diff)
}

$update['$push'][self::pathToDotWithoutLastPart($op['path'])]['$each'][] = $op['value'];
} else if (is_array($op['value']) && array_key_exists(0, $op['value'])) {
$update['$set'][self::pathToDot($op['path'])] = $op['value'];
} else if (is_array($op['value'])) {
foreach ($op['value'] as $key => $value) {
$update['$set'][self::pathToDot($op['path']) . '.' . $key] = $value;
Expand Down

0 comments on commit 8d61d69

Please sign in to comment.