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

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.     /**
  28.      * @param class-string $driverClassName
  29.      */
  30.     public static function pathRequiredForDriver(string $driverClassName): self
  31.     {
  32.         return new self(sprintf(
  33.             'Specifying the paths to your entities is required when using %s to retrieve all class names.',
  34.             $driverClassName
  35.         ));
  36.     }
  37.     /**
  38.      * @return self
  39.      */
  40.     public static function fileMappingDriversRequireConfiguredDirectoryPath(
  41.         ?string $path null
  42.     ) {
  43.         if ($path !== null) {
  44.             $path '[' $path ']';
  45.         }
  46.         return new self(sprintf(
  47.             'File mapping drivers must have a valid directory path, ' .
  48.             'however the given path %s seems to be incorrect!',
  49.             (string) $path
  50.         ));
  51.     }
  52.     /**
  53.      * @return self
  54.      */
  55.     public static function mappingFileNotFound(string $entityNamestring $fileName)
  56.     {
  57.         return new self(sprintf(
  58.             "No mapping file found named '%s' for class '%s'.",
  59.             $fileName,
  60.             $entityName
  61.         ));
  62.     }
  63.     /**
  64.      * @return self
  65.      */
  66.     public static function invalidMappingFile(string $entityNamestring $fileName)
  67.     {
  68.         return new self(sprintf(
  69.             "Invalid mapping file '%s' for class '%s'.",
  70.             $fileName,
  71.             $entityName
  72.         ));
  73.     }
  74.     /**
  75.      * @return self
  76.      */
  77.     public static function nonExistingClass(string $className)
  78.     {
  79.         return new self(sprintf("Class '%s' does not exist"$className));
  80.     }
  81.     /**
  82.      * @param class-string $className
  83.      */
  84.     public static function classIsAnonymous(string $className): self
  85.     {
  86.         return new self(sprintf('Class "%s" is anonymous'$className));
  87.     }
  88. }