vendor/doctrine/persistence/lib/Doctrine/Persistence/Mapping/MappingException.php line 94

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