Commit bbfbbd65 authored by Katherine Walker's avatar Katherine Walker

Merge pull request #531

parents 29f7cd0b 491c3b7f
...@@ -221,6 +221,7 @@ description: | ...@@ -221,6 +221,7 @@ description: |
Prevents the cursor from returning a document more than once because of an Prevents the cursor from returning a document more than once because of an
intervening write operation. intervening write operation.
.. deprecated:: 1.4
.. versionadded:: 1.2 .. versionadded:: 1.2
interface: phpmethod interface: phpmethod
operation: ~ operation: ~
......
...@@ -128,6 +128,8 @@ class Find implements Executable, Explainable ...@@ -128,6 +128,8 @@ class Find implements Executable, Explainable
* * snapshot (boolean): Prevents the cursor from returning a document more * * snapshot (boolean): Prevents the cursor from returning a document more
* than once because of an intervening write operation. * than once because of an intervening write operation.
* *
* This options has been deprecated since version 1.4.
*
* * sort (document): The order in which to return matching documents. If * * sort (document): The order in which to return matching documents. If
* "$orderby" also exists in the modifiers document, this option will * "$orderby" also exists in the modifiers document, this option will
* take precedence. * take precedence.
...@@ -259,6 +261,10 @@ class Find implements Executable, Explainable ...@@ -259,6 +261,10 @@ class Find implements Executable, Explainable
unset($options['readConcern']); unset($options['readConcern']);
} }
if (isset($options['snapshot'])) {
trigger_error('The "snapshot" option is deprecated and will be removed in a future release', E_USER_DEPRECATED);
}
$this->databaseName = (string) $databaseName; $this->databaseName = (string) $databaseName;
$this->collectionName = (string) $collectionName; $this->collectionName = (string) $collectionName;
$this->filter = $filter; $this->filter = $filter;
......
...@@ -128,6 +128,17 @@ class FindTest extends TestCase ...@@ -128,6 +128,17 @@ class FindTest extends TestCase
return $options; return $options;
} }
public function testSnapshotOptionIsDeprecated()
{
$this->assertDeprecated(function() {
new Find($this->getDatabaseName(), $this->getCollectionName(), [], ['snapshot' => true]);
});
$this->assertDeprecated(function() {
new Find($this->getDatabaseName(), $this->getCollectionName(), [], ['snapshot' => false]);
});
}
private function getInvalidHintValues() private function getInvalidHintValues()
{ {
return [123, 3.14, true]; return [123, 3.14, true];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment