1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
4
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
5
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
6
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
7
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
8
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
9
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
10
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
11
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
12
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
13
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
14
|
|
|
*/ |
15
|
|
|
|
16
|
|
|
if (class_exists('MongoWriteConcernException', false)) { |
17
|
|
|
return; |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* <p>(PECL mongo >= 1.5.0)</p> |
22
|
|
|
* @link http://php.net/manual/en/class.mongowriteconcernexception.php#class.mongowriteconcernexception |
23
|
|
|
*/ |
24
|
|
|
class MongoWriteConcernException extends MongoCursorException |
25
|
|
|
{ |
26
|
|
|
private $document; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* MongoWriteConcernException constructor. |
30
|
|
|
* |
31
|
|
|
* @param string $message |
32
|
|
|
* @param int $code |
33
|
|
|
* @param Exception|null $previous |
34
|
|
|
* @param null $document |
35
|
|
|
* |
36
|
|
|
* @internal The $document parameter is not part of the ext-mongo API |
37
|
|
|
*/ |
38
|
|
|
public function __construct($message = '', $code = 0, Exception $previous = null, $document = null) |
39
|
|
|
{ |
40
|
|
|
parent::__construct($message, $code, $previous); |
41
|
|
|
|
42
|
|
|
$this->document = $document; |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* Get the error document |
47
|
|
|
* @link http://php.net/manual/en/mongowriteconcernexception.getdocument.php |
48
|
|
|
* @return array <p>A MongoDB document, if available, as an array.</p> |
49
|
|
|
*/ |
50
|
|
|
public function getDocument() |
51
|
|
|
{ |
52
|
|
|
return $this->document; |
53
|
|
|
} |
54
|
|
|
} |
55
|
|
|
|