vendor/doctrine/persistence/src/Persistence/Mapping/MappingException.php line 26

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace Doctrine\Persistence\Mapping;
  4. use Exception;
  5. use function implode;
  6. use function sprintf;
  7. /**
  8.  * A MappingException indicates that something is wrong with the mapping setup.
  9.  */
  10. class MappingException extends Exception
  11. {
  12.     /**
  13.      * @param array<int, string> $namespaces
  14.      *
  15.      * @return self
  16.      */
  17.     public static function classNotFoundInNamespaces(
  18.         string $className,
  19.         array $namespaces
  20.     ) {
  21.         return new self(sprintf(
  22.             "The class '%s' was not found in the chain configured namespaces %s",
  23.             $className,
  24.             implode(', '$namespaces)
  25.         ));
  26.     }
  27.     /** @param class-string $driverClassName */
  28.     public static function pathRequiredForDriver(string $driverClassName): self
  29.     {
  30.         return new self(sprintf(
  31.             'Specifying the paths to your entities is required when using %s to retrieve all class names.',
  32.             $driverClassName
  33.         ));
  34.     }
  35.     /** @return self */
  36.     public static function fileMappingDriversRequireConfiguredDirectoryPath(
  37.         ?string $path null
  38.     ) {
  39.         if ($path !== null) {
  40.             $path '[' $path ']';
  41.         }
  42.         return new self(sprintf(
  43.             'File mapping drivers must have a valid directory path, ' .
  44.             'however the given path %s seems to be incorrect!',
  45.             (string) $path
  46.         ));
  47.     }
  48.     /** @return self */
  49.     public static function mappingFileNotFound(string $entityNamestring $fileName)
  50.     {
  51.         return new self(sprintf(
  52.             "No mapping file found named '%s' for class '%s'.",
  53.             $fileName,
  54.             $entityName
  55.         ));
  56.     }
  57.     /** @return self */
  58.     public static function invalidMappingFile(string $entityNamestring $fileName)
  59.     {
  60.         return new self(sprintf(
  61.             "Invalid mapping file '%s' for class '%s'.",
  62.             $fileName,
  63.             $entityName
  64.         ));
  65.     }
  66.     /** @return self */
  67.     public static function nonExistingClass(string $className)
  68.     {
  69.         return new self(sprintf("Class '%s' does not exist"$className));
  70.     }
  71.     /** @param class-string $className */
  72.     public static function classIsAnonymous(string $className): self
  73.     {
  74.         return new self(sprintf('Class "%s" is anonymous'$className));
  75.     }
  76. }