Skip to content

Commit

Permalink
Ensure objects with numeric keys remain objects
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus committed Feb 10, 2016
1 parent ae36b1e commit 6c75596
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/Alcaeus/MongoDbAdapter/TypeConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,10 @@ private static function convertBSONObjectToLegacy(BSON\Type $value)
*/
private static function ensureCorrectType(array $array, $wasObject = false)
{
if ($array === [] && $wasObject) {
return (object) $array;
if ($wasObject || ! static::isNumericArray($array)) {
return new Model\BSONDocument($array);
}

if (static::isNumericArray($array)) {
return $array;
}

return new Model\BSONDocument($array);
return $array;
}
}

0 comments on commit 6c75596

Please sign in to comment.