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/persistence/src/Persistence/Mapping/MappingException.php | |
| parent | 94d67a4b51f8e62e7d518cce26a526ae1ec48278 (diff) | |
| download | AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.tar.gz AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.tar.bz2 AppliGestionPHP-bf6655a534a6775d30cafa67bd801276bda1d98d.zip | |
VERSION 0.2 doctrine ORM et entités
Diffstat (limited to 'vendor/doctrine/persistence/src/Persistence/Mapping/MappingException.php')
| -rw-r--r-- | vendor/doctrine/persistence/src/Persistence/Mapping/MappingException.php | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/vendor/doctrine/persistence/src/Persistence/Mapping/MappingException.php b/vendor/doctrine/persistence/src/Persistence/Mapping/MappingException.php new file mode 100644 index 0000000..f0bc4eb --- /dev/null +++ b/vendor/doctrine/persistence/src/Persistence/Mapping/MappingException.php | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | <?php | ||
| 2 | |||
| 3 | declare(strict_types=1); | ||
| 4 | |||
| 5 | namespace Doctrine\Persistence\Mapping; | ||
| 6 | |||
| 7 | use Exception; | ||
| 8 | |||
| 9 | use function implode; | ||
| 10 | use function sprintf; | ||
| 11 | |||
| 12 | /** | ||
| 13 | * A MappingException indicates that something is wrong with the mapping setup. | ||
| 14 | */ | ||
| 15 | class MappingException extends Exception | ||
| 16 | { | ||
| 17 | /** | ||
| 18 | * @param array<int, string> $namespaces | ||
| 19 | * | ||
| 20 | * @return self | ||
| 21 | */ | ||
| 22 | public static function classNotFoundInNamespaces( | ||
| 23 | string $className, | ||
| 24 | array $namespaces | ||
| 25 | ) { | ||
| 26 | return new self(sprintf( | ||
| 27 | "The class '%s' was not found in the chain configured namespaces %s", | ||
| 28 | $className, | ||
| 29 | implode(', ', $namespaces) | ||
| 30 | )); | ||
| 31 | } | ||
| 32 | |||
| 33 | /** @param class-string $driverClassName */ | ||
| 34 | public static function pathRequiredForDriver(string $driverClassName): self | ||
| 35 | { | ||
| 36 | return new self(sprintf( | ||
| 37 | 'Specifying the paths to your entities is required when using %s to retrieve all class names.', | ||
| 38 | $driverClassName | ||
| 39 | )); | ||
| 40 | } | ||
| 41 | |||
| 42 | /** @return self */ | ||
| 43 | public static function fileMappingDriversRequireConfiguredDirectoryPath( | ||
| 44 | ?string $path = null | ||
| 45 | ) { | ||
| 46 | if ($path !== null) { | ||
| 47 | $path = '[' . $path . ']'; | ||
| 48 | } | ||
| 49 | |||
| 50 | return new self(sprintf( | ||
| 51 | 'File mapping drivers must have a valid directory path, ' . | ||
| 52 | 'however the given path %s seems to be incorrect!', | ||
| 53 | (string) $path | ||
| 54 | )); | ||
| 55 | } | ||
| 56 | |||
| 57 | /** @return self */ | ||
| 58 | public static function mappingFileNotFound(string $entityName, string $fileName) | ||
| 59 | { | ||
| 60 | return new self(sprintf( | ||
| 61 | "No mapping file found named '%s' for class '%s'.", | ||
| 62 | $fileName, | ||
| 63 | $entityName | ||
| 64 | )); | ||
| 65 | } | ||
| 66 | |||
| 67 | /** @return self */ | ||
| 68 | public static function invalidMappingFile(string $entityName, string $fileName) | ||
| 69 | { | ||
| 70 | return new self(sprintf( | ||
| 71 | "Invalid mapping file '%s' for class '%s'.", | ||
| 72 | $fileName, | ||
| 73 | $entityName | ||
| 74 | )); | ||
| 75 | } | ||
| 76 | |||
| 77 | /** @return self */ | ||
| 78 | public static function nonExistingClass(string $className) | ||
| 79 | { | ||
| 80 | return new self(sprintf("Class '%s' does not exist", $className)); | ||
| 81 | } | ||
| 82 | |||
| 83 | /** @param class-string $className */ | ||
| 84 | public static function classIsAnonymous(string $className): self | ||
| 85 | { | ||
| 86 | return new self(sprintf('Class "%s" is anonymous', $className)); | ||
| 87 | } | ||
| 88 | } | ||
