Skip to content

Commit c9e942f

Browse files
jmikoladerickr
authored andcommitted
Extract Collection findAndModify methods to operation classes
1 parent b2e13a5 commit c9e942f

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/Collection.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,19 @@ final protected function _delete($filter, $limit = 1)
835835
return $this->manager->executeBulkWrite($this->ns, $bulk, $this->wc);
836836
}
837837

838+
/**
839+
* Internal helper for throwing an exception with error message
840+
* @internal
841+
*/
842+
final protected function _generateCommandException($doc)
843+
{
844+
if ($doc["errmsg"]) {
845+
return new RuntimeException($doc["errmsg"]);
846+
}
847+
var_dump($doc);
848+
return new RuntimeException("FIXME: Unknown error");
849+
}
850+
838851
/**
839852
* Constructs the Query Wire Protocol field 'flags' based on $options
840853
* provided to other helpers

src/Operation/FindOneAndReplace.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ public function __construct($databaseName, $collectionName, $filter, $replacemen
113113
*
114114
* @see Executable::execute()
115115
* @param Server $server
116+
<<<<<<< HEAD
116117
* @return object|null
118+
=======
119+
* @return array|null
120+
>>>>>>> Extract Collection findAndModify methods to operation classes
117121
*/
118122
public function execute(Server $server)
119123
{

src/Operation/FindOneAndUpdate.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,11 @@ public function __construct($databaseName, $collectionName, $filter, $update, ar
113113
*
114114
* @see Executable::execute()
115115
* @param Server $server
116+
<<<<<<< HEAD
116117
* @return object|null
118+
=======
119+
* @return array|null
120+
>>>>>>> Extract Collection findAndModify methods to operation classes
117121
*/
118122
public function execute(Server $server)
119123
{

0 commit comments

Comments
 (0)