1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* $Id$ |
4
|
|
|
* |
5
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
6
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
7
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
8
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
9
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
10
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
11
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
12
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
13
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
14
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
15
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
16
|
|
|
* |
17
|
|
|
* This software consists of voluntary contributions made by many individuals |
18
|
|
|
* and is licensed under the MIT license. For more information, see |
19
|
|
|
* <http://www.doctrine-project.org>. |
20
|
|
|
*/ |
21
|
|
|
|
22
|
|
|
namespace Doctrine\ODM\MongoDB\Event; |
23
|
|
|
|
24
|
|
|
use Doctrine\ODM\MongoDB\DocumentManager; |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Provides event arguments for the documentNotFound event. |
28
|
|
|
* |
29
|
|
|
* @since 1.1 |
30
|
|
|
*/ |
31
|
|
|
class DocumentNotFoundEventArgs extends LifecycleEventArgs |
32
|
|
|
{ |
33
|
|
|
/** |
34
|
|
|
* @var string |
35
|
|
|
*/ |
36
|
|
|
private $identifier; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @var bool |
40
|
|
|
*/ |
41
|
|
|
private $disableException = false; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Constructor. |
45
|
|
|
* |
46
|
|
|
* @param object $document |
47
|
|
|
* @param DocumentManager $dm |
48
|
|
|
* @param string $identifier |
49
|
|
|
*/ |
50
|
9 |
|
public function __construct($document, DocumentManager $dm, $identifier) |
51
|
|
|
{ |
52
|
9 |
|
parent::__construct($document, $dm); |
53
|
9 |
|
$this->identifier = $identifier; |
54
|
9 |
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Retrieve associated identifier. |
58
|
|
|
* |
59
|
|
|
* @return string |
60
|
|
|
*/ |
61
|
|
|
public function getIdentifier() |
62
|
|
|
{ |
63
|
|
|
return $this->identifier; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* Indicates whether the proxy initialization exception is disabled. |
68
|
|
|
* |
69
|
|
|
* @return bool |
70
|
|
|
*/ |
71
|
9 |
|
public function isExceptionDisabled() |
72
|
|
|
{ |
73
|
9 |
|
return $this->disableException; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Disable the throwing of an exception |
78
|
|
|
* |
79
|
|
|
* This method indicates to the proxy initializer that the missing document |
80
|
|
|
* has been handled and no exception should be thrown. This can't be reset. |
81
|
|
|
* |
82
|
|
|
* @param bool $disableException |
83
|
|
|
*/ |
84
|
1 |
|
public function disableException($disableException = true) |
85
|
|
|
{ |
86
|
1 |
|
$this->disableException = $disableException; |
87
|
1 |
|
} |
88
|
|
|
} |
89
|
|
|
|