Skip to content

Commit c10f2e2

Browse files
committed
Fixed PHPLIB-108: Library relies on BSON being a vendor prefix, while our vendor should be MongoDB
1 parent 37fcb2c commit c10f2e2

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

src/BulkWriteResult.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace MongoDB;
44

5-
use BSON\ObjectId;
5+
use MongoDB\BSON\ObjectId;
66
use MongoDB\Driver\WriteResult;
77

88
/**

src/Collection.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,17 @@ final protected function _opQueryFlags($options)
868868
return $flags;
869869
}
870870

871+
/**
872+
* Internal helper for running a command
873+
* @internal
874+
*/
875+
final protected function _runCommand($dbname, array $cmd, ReadPreference $rp = null)
876+
{
877+
//var_dump(\MongoDB\BSON\toJSON(\MongoDB\BSON\fromArray($cmd)));
878+
$command = new Command($cmd);
879+
return $this->manager->executeCommand($dbname, $command, $rp);
880+
}
881+
871882
/**
872883
* Internal helper for replacing/updating one/many documents
873884
* @internal

src/Model/IndexInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace MongoDB\Model;
44

5-
use BSON\Serializable;
5+
use MongoDB\BSON\Serializable;
66
use MongoDB\Exception\InvalidArgumentException;
77
use MongoDB\Exception\UnexpectedTypeException;
88

tests/Collection/BulkWriteFunctionalTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function testInserts()
2828

2929
$insertedIds = $result->getInsertedIds();
3030
$this->assertSame(1, $insertedIds[0]);
31-
$this->assertInstanceOf('BSON\ObjectId', $insertedIds[1]);
31+
$this->assertInstanceOf('MongoDB\BSON\ObjectId', $insertedIds[1]);
3232

3333
$expected = array(
3434
array('_id' => $insertedIds[0], 'x' => 11),
@@ -58,7 +58,7 @@ public function testUpdates()
5858

5959
$upsertedIds = $result->getUpsertedIds();
6060
$this->assertSame(5, $upsertedIds[2]);
61-
$this->assertInstanceOf('BSON\ObjectId', $upsertedIds[3]);
61+
$this->assertInstanceOf('MongoDB\BSON\ObjectId', $upsertedIds[3]);
6262

6363
$expected = array(
6464
array('_id' => 1, 'x' => 11),
@@ -215,4 +215,4 @@ private function createFixtures($n)
215215

216216
$this->assertEquals($n, $result->getInsertedCount());
217217
}
218-
}
218+
}

tests/Model/IndexInputTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function testBsonSerialization()
8787
'ns' => 'foo.bar',
8888
));
8989

90-
$this->assertInstanceOf('BSON\Serializable', $indexInput);
90+
$this->assertInstanceOf('MongoDB\BSON\Serializable', $indexInput);
9191
$this->assertEquals($expected, $indexInput->bsonSerialize());
9292
}
9393
}

0 commit comments

Comments
 (0)