|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace Doctrine\ORM\Internal\Hydration; |
|
6
|
|
|
|
|
7
|
|
|
use Doctrine\ORM\ORMException; |
|
8
|
|
|
|
|
9
|
|
|
class HydrationException extends ORMException |
|
10
|
|
|
{ |
|
11
|
|
|
/** |
|
12
|
|
|
* @return HydrationException |
|
13
|
|
|
*/ |
|
14
|
|
|
public static function nonUniqueResult() |
|
15
|
|
|
{ |
|
16
|
|
|
return new self('The result returned by the query was not unique.'); |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* @param string $alias |
|
21
|
|
|
* @param string $parentAlias |
|
22
|
|
|
* |
|
23
|
|
|
* @return HydrationException |
|
24
|
|
|
*/ |
|
25
|
1 |
|
public static function parentObjectOfRelationNotFound($alias, $parentAlias) |
|
26
|
|
|
{ |
|
27
|
1 |
|
return new self(sprintf( |
|
28
|
1 |
|
"The parent object of entity result with alias '%s' was not found. The parent alias is '%s'.", |
|
29
|
1 |
|
$alias, |
|
30
|
1 |
|
$parentAlias |
|
31
|
|
|
)); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* @param string $dqlAlias |
|
36
|
|
|
* |
|
37
|
|
|
* @return HydrationException |
|
38
|
|
|
*/ |
|
39
|
|
|
public static function emptyDiscriminatorValue($dqlAlias) |
|
40
|
|
|
{ |
|
41
|
|
|
return new self("The DQL alias '" . $dqlAlias . "' contains an entity " . |
|
42
|
|
|
'of an inheritance hierarchy with an empty discriminator value. This means ' . |
|
43
|
|
|
'that the database contains inconsistent data with an empty ' . |
|
44
|
|
|
'discriminator value in a table row.'); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @param string $entityName |
|
49
|
|
|
* @param string $discrColumnName |
|
50
|
|
|
* @param string $dqlAlias |
|
51
|
|
|
* |
|
52
|
|
|
* @return HydrationException |
|
53
|
|
|
*/ |
|
54
|
2 |
|
public static function missingDiscriminatorColumn($entityName, $discrColumnName, $dqlAlias) |
|
55
|
|
|
{ |
|
56
|
2 |
|
return new self(sprintf( |
|
57
|
2 |
|
'The discriminator column "%s" is missing for "%s" using the DQL alias "%s".', |
|
58
|
2 |
|
$discrColumnName, |
|
59
|
2 |
|
$entityName, |
|
60
|
2 |
|
$dqlAlias |
|
61
|
|
|
)); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @param string $entityName |
|
66
|
|
|
* @param string $discrColumnName |
|
67
|
|
|
* @param string $dqlAlias |
|
68
|
|
|
* |
|
69
|
|
|
* @return HydrationException |
|
70
|
|
|
*/ |
|
71
|
1 |
|
public static function missingDiscriminatorMetaMappingColumn($entityName, $discrColumnName, $dqlAlias) |
|
72
|
|
|
{ |
|
73
|
1 |
|
return new self(sprintf( |
|
74
|
1 |
|
'The meta mapping for the discriminator column "%s" is missing for "%s" using the DQL alias "%s".', |
|
75
|
1 |
|
$discrColumnName, |
|
76
|
1 |
|
$entityName, |
|
77
|
1 |
|
$dqlAlias |
|
78
|
|
|
)); |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @param string $discrValue |
|
83
|
|
|
* @param string[] $discrMap |
|
84
|
|
|
* |
|
85
|
|
|
* @return HydrationException |
|
86
|
|
|
*/ |
|
87
|
2 |
|
public static function invalidDiscriminatorValue($discrValue, $discrMap) |
|
88
|
|
|
{ |
|
89
|
2 |
|
return new self(sprintf( |
|
90
|
2 |
|
'The discriminator value "%s" is invalid. It must be one of "%s".', |
|
91
|
2 |
|
$discrValue, |
|
92
|
2 |
|
implode('", "', $discrMap) |
|
93
|
|
|
)); |
|
94
|
|
|
} |
|
95
|
|
|
} |
|
96
|
|
|
|