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
|
|
|
* This software consists of voluntary contributions made by many individuals |
16
|
|
|
* and is licensed under the MIT license. For more information, see |
17
|
|
|
* <http://www.doctrine-project.org>. |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
namespace Doctrine\ORM\Internal\Hydration; |
21
|
|
|
|
22
|
|
|
class HydrationException extends \Doctrine\ORM\ORMException |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* @return HydrationException |
26
|
|
|
*/ |
27
|
|
|
public static function nonUniqueResult() |
28
|
|
|
{ |
29
|
|
|
return new self("The result returned by the query was not unique."); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @param string $alias |
34
|
|
|
* @param string $parentAlias |
35
|
|
|
* |
36
|
|
|
* @return HydrationException |
37
|
|
|
*/ |
38
|
1 |
|
public static function parentObjectOfRelationNotFound($alias, $parentAlias) |
39
|
|
|
{ |
40
|
1 |
|
return new self("The parent object of entity result with alias '$alias' was not found." |
41
|
1 |
|
. " The parent alias is '$parentAlias'."); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* @param string $dqlAlias |
46
|
|
|
* |
47
|
|
|
* @return HydrationException |
48
|
|
|
*/ |
49
|
|
|
public static function emptyDiscriminatorValue($dqlAlias) |
50
|
|
|
{ |
51
|
|
|
return new self("The DQL alias '" . $dqlAlias . "' contains an entity ". |
52
|
|
|
"of an inheritance hierarchy with an empty discriminator value. This means " . |
53
|
|
|
"that the database contains inconsistent data with an empty " . |
54
|
|
|
"discriminator value in a table row." |
55
|
|
|
); |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @since 2.3 |
60
|
|
|
* |
61
|
|
|
* @param string $entityName |
62
|
|
|
* @param string $discrColumnName |
63
|
|
|
* @param string $dqlAlias |
64
|
|
|
* |
65
|
|
|
* @return HydrationException |
66
|
|
|
*/ |
67
|
2 |
|
public static function missingDiscriminatorColumn($entityName, $discrColumnName, $dqlAlias) |
68
|
|
|
{ |
69
|
2 |
|
return new self(sprintf( |
70
|
2 |
|
'The discriminator column "%s" is missing for "%s" using the DQL alias "%s".', |
71
|
2 |
|
$discrColumnName, $entityName, $dqlAlias |
72
|
|
|
)); |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* @since 2.3 |
77
|
|
|
* |
78
|
|
|
* @param string $entityName |
79
|
|
|
* @param string $discrColumnName |
80
|
|
|
* @param string $dqlAlias |
81
|
|
|
* |
82
|
|
|
* @return HydrationException |
83
|
|
|
*/ |
84
|
1 |
|
public static function missingDiscriminatorMetaMappingColumn($entityName, $discrColumnName, $dqlAlias) |
85
|
|
|
{ |
86
|
1 |
|
return new self(sprintf( |
87
|
1 |
|
'The meta mapping for the discriminator column "%s" is missing for "%s" using the DQL alias "%s".', |
88
|
1 |
|
$discrColumnName, $entityName, $dqlAlias |
89
|
|
|
)); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @param string $discrValue |
94
|
|
|
* @param array $discrMap |
95
|
|
|
* |
96
|
|
|
* @return HydrationException |
97
|
|
|
*/ |
98
|
2 |
|
public static function invalidDiscriminatorValue($discrValue, $discrMap) |
99
|
|
|
{ |
100
|
2 |
|
return new self(sprintf( |
101
|
2 |
|
'The discriminator value "%s" is invalid. It must be one of "%s".', |
102
|
2 |
|
$discrValue, implode('", "', $discrMap) |
103
|
|
|
)); |
104
|
|
|
} |
105
|
|
|
} |
106
|
|
|
|