diff options
author | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
---|---|---|
committer | polo <ordipolo@gmx.fr> | 2024-08-13 23:45:21 +0200 |
commit | bf6655a534a6775d30cafa67bd801276bda1d98d (patch) | |
tree | c6381e3f6c81c33eab72508f410b165ba05f7e9c /vendor/doctrine/orm/src/Internal/Hydration/HydrationException.php | |
parent | 94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff) | |
download | AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip |
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'vendor/doctrine/orm/src/Internal/Hydration/HydrationException.php')
-rw-r--r-- | vendor/doctrine/orm/src/Internal/Hydration/HydrationException.php | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/vendor/doctrine/orm/src/Internal/Hydration/HydrationException.php b/vendor/doctrine/orm/src/Internal/Hydration/HydrationException.php new file mode 100644 index 0000000..710114f --- /dev/null +++ b/vendor/doctrine/orm/src/Internal/Hydration/HydrationException.php | |||
@@ -0,0 +1,67 @@ | |||
1 | <?php | ||
2 | |||
3 | declare(strict_types=1); | ||
4 | |||
5 | namespace Doctrine\ORM\Internal\Hydration; | ||
6 | |||
7 | use Doctrine\ORM\Exception\ORMException; | ||
8 | use Exception; | ||
9 | |||
10 | use function implode; | ||
11 | use function sprintf; | ||
12 | |||
13 | class HydrationException extends Exception implements ORMException | ||
14 | { | ||
15 | public static function nonUniqueResult(): self | ||
16 | { | ||
17 | return new self('The result returned by the query was not unique.'); | ||
18 | } | ||
19 | |||
20 | public static function parentObjectOfRelationNotFound(string $alias, string $parentAlias): self | ||
21 | { | ||
22 | return new self(sprintf( | ||
23 | "The parent object of entity result with alias '%s' was not found." | ||
24 | . " The parent alias is '%s'.", | ||
25 | $alias, | ||
26 | $parentAlias, | ||
27 | )); | ||
28 | } | ||
29 | |||
30 | public static function emptyDiscriminatorValue(string $dqlAlias): self | ||
31 | { | ||
32 | return new self("The DQL alias '" . $dqlAlias . "' contains an entity " . | ||
33 | 'of an inheritance hierarchy with an empty discriminator value. This means ' . | ||
34 | 'that the database contains inconsistent data with an empty ' . | ||
35 | 'discriminator value in a table row.'); | ||
36 | } | ||
37 | |||
38 | public static function missingDiscriminatorColumn(string $entityName, string $discrColumnName, string $dqlAlias): self | ||
39 | { | ||
40 | return new self(sprintf( | ||
41 | 'The discriminator column "%s" is missing for "%s" using the DQL alias "%s".', | ||
42 | $discrColumnName, | ||
43 | $entityName, | ||
44 | $dqlAlias, | ||
45 | )); | ||
46 | } | ||
47 | |||
48 | public static function missingDiscriminatorMetaMappingColumn(string $entityName, string $discrColumnName, string $dqlAlias): self | ||
49 | { | ||
50 | return new self(sprintf( | ||
51 | 'The meta mapping for the discriminator column "%s" is missing for "%s" using the DQL alias "%s".', | ||
52 | $discrColumnName, | ||
53 | $entityName, | ||
54 | $dqlAlias, | ||
55 | )); | ||
56 | } | ||
57 | |||
58 | /** @param list<int|string> $discrValues */ | ||
59 | public static function invalidDiscriminatorValue(string $discrValue, array $discrValues): self | ||
60 | { | ||
61 | return new self(sprintf( | ||
62 | 'The discriminator value "%s" is invalid. It must be one of "%s".', | ||
63 | $discrValue, | ||
64 | implode('", "', $discrValues), | ||
65 | )); | ||
66 | } | ||
67 | } | ||