Skip to content

Commit 81fcefc

Browse files
committed
PHPLIB-74: Use array and document classes in default type map
1 parent afb7487 commit 81fcefc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Client.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ class Client
4040
*/
4141
public function __construct($uri = 'mongodb://localhost:27017', array $uriOptions = [], array $driverOptions = [])
4242
{
43+
$driverOptions += [
44+
'typeMap' => [
45+
'array' => 'MongoDB\Model\BSONArray',
46+
'document' => 'MongoDB\Model\BSONDocument',
47+
'root' => 'MongoDB\Model\BSONDocument',
48+
],
49+
];
50+
4351
if (isset($driverOptions['typeMap']) && ! is_array($driverOptions['typeMap'])) {
4452
throw new InvalidArgumentTypeException('"typeMap" driver option', $driverOptions['typeMap'], 'array');
4553
}

0 commit comments

Comments
 (0)