From be1df64a5da9fedb1917c3502f11afa6ecabbfe5 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Wed, 10 Jun 2015 12:47:34 +0100 Subject: [PATCH 1/2] Fixed PHPLIB-108: Library relies on BSON being a vendor prefix, while our vendor should be MongoDB --- src/BulkWriteResult.php | 2 +- src/Collection.php | 11 +++++++++++ src/Model/IndexInput.php | 2 +- tests/Collection/BulkWriteFunctionalTest.php | 6 +++--- tests/Model/IndexInputTest.php | 2 +- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/BulkWriteResult.php b/src/BulkWriteResult.php index 2862a59cd..15117bdb6 100644 --- a/src/BulkWriteResult.php +++ b/src/BulkWriteResult.php @@ -2,7 +2,7 @@ namespace MongoDB; -use BSON\ObjectId; +use MongoDB\BSON\ObjectId; use MongoDB\Driver\WriteResult; /** diff --git a/src/Collection.php b/src/Collection.php index 8d0d21871..4ef96a613 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -855,6 +855,17 @@ final protected function _opQueryFlags($options) return $flags; } + /** + * Internal helper for running a command + * @internal + */ + final protected function _runCommand($dbname, array $cmd, ReadPreference $rp = null) + { + //var_dump(\MongoDB\BSON\toJSON(\MongoDB\BSON\fromArray($cmd))); + $command = new Command($cmd); + return $this->manager->executeCommand($dbname, $command, $rp); + } + /** * Internal helper for replacing/updating one/many documents * @internal diff --git a/src/Model/IndexInput.php b/src/Model/IndexInput.php index db4288992..3f55a3544 100644 --- a/src/Model/IndexInput.php +++ b/src/Model/IndexInput.php @@ -2,7 +2,7 @@ namespace MongoDB\Model; -use BSON\Serializable; +use MongoDB\BSON\Serializable; use MongoDB\Exception\InvalidArgumentException; use MongoDB\Exception\UnexpectedTypeException; diff --git a/tests/Collection/BulkWriteFunctionalTest.php b/tests/Collection/BulkWriteFunctionalTest.php index 29a80f644..947768e0d 100644 --- a/tests/Collection/BulkWriteFunctionalTest.php +++ b/tests/Collection/BulkWriteFunctionalTest.php @@ -28,7 +28,7 @@ public function testInserts() $insertedIds = $result->getInsertedIds(); $this->assertSame(1, $insertedIds[0]); - $this->assertInstanceOf('BSON\ObjectId', $insertedIds[1]); + $this->assertInstanceOf('MongoDB\BSON\ObjectId', $insertedIds[1]); $expected = array( array('_id' => $insertedIds[0], 'x' => 11), @@ -58,7 +58,7 @@ public function testUpdates() $upsertedIds = $result->getUpsertedIds(); $this->assertSame(5, $upsertedIds[2]); - $this->assertInstanceOf('BSON\ObjectId', $upsertedIds[3]); + $this->assertInstanceOf('MongoDB\BSON\ObjectId', $upsertedIds[3]); $expected = array( array('_id' => 1, 'x' => 11), @@ -215,4 +215,4 @@ private function createFixtures($n) $this->assertEquals($n, $result->getInsertedCount()); } -} \ No newline at end of file +} diff --git a/tests/Model/IndexInputTest.php b/tests/Model/IndexInputTest.php index 7b354a4d1..c3269313d 100644 --- a/tests/Model/IndexInputTest.php +++ b/tests/Model/IndexInputTest.php @@ -87,7 +87,7 @@ public function testBsonSerialization() 'ns' => 'foo.bar', )); - $this->assertInstanceOf('BSON\Serializable', $indexInput); + $this->assertInstanceOf('MongoDB\BSON\Serializable', $indexInput); $this->assertEquals($expected, $indexInput->bsonSerialize()); } } From 82c604574526b2b7e25e3f2c096018c8a3466aa8 Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Tue, 30 Jun 2015 09:11:30 +0100 Subject: [PATCH 2/2] Removed odd new function --- src/Collection.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/Collection.php b/src/Collection.php index 4ef96a613..8d0d21871 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -855,17 +855,6 @@ final protected function _opQueryFlags($options) return $flags; } - /** - * Internal helper for running a command - * @internal - */ - final protected function _runCommand($dbname, array $cmd, ReadPreference $rp = null) - { - //var_dump(\MongoDB\BSON\toJSON(\MongoDB\BSON\fromArray($cmd))); - $command = new Command($cmd); - return $this->manager->executeCommand($dbname, $command, $rp); - } - /** * Internal helper for replacing/updating one/many documents * @internal