Skip to content

Commit ef58cf4

Browse files
authored
Remove usage of deprecated BSON functions (#1361)
* Remove usage of deprecated BSON functions * Fix psalm issues * Refactor test
1 parent 87ab8a2 commit ef58cf4

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

source/tutorial/custom-types.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ back to ``LocalDateTime``.
151151
.. code-block:: php
152152

153153
<?php
154-
$bson = MongoDB\BSON\fromPHP(['date' => new LocalDateTime]);
155-
$document = MongoDB\BSON\toPHP($bson);
154+
$bson = MongoDB\BSON\Document::fromPHP(['date' => new LocalDateTime]);
155+
$document = $bson->toPHP();
156156

157157
var_dump($document);
158158
var_dump($document->date->toDateTime());

source/tutorial/example-data.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ example imports the ``zips.json`` file into a ``test.zips`` collection using the
2222
$bulk = new MongoDB\Driver\BulkWrite;
2323

2424
foreach ($lines as $line) {
25-
$bson = MongoDB\BSON\fromJSON($line);
26-
$document = MongoDB\BSON\toPHP($bson);
25+
$bson = MongoDB\BSON\Document::fromJSON($line);
26+
$document = $bson->toPHP();
2727
$bulk->insert($document);
2828
}
2929

0 commit comments

Comments
 (0)