vendor/doctrine-dbal/lib/Doctrine/DBAL/DBALException.php
changeset 0 7f95f8617b0b
equal deleted inserted replaced
-1:000000000000 0:7f95f8617b0b
       
     1 <?php
       
     2 
       
     3 namespace Doctrine\DBAL;
       
     4 
       
     5 class DBALException extends \Exception
       
     6 {
       
     7     public static function notSupported($method)
       
     8     {
       
     9         return new self("Operation '$method' is not supported by platform.");
       
    10     }
       
    11 
       
    12     public static function invalidPlatformSpecified()
       
    13     {
       
    14         return new self(
       
    15             "Invalid 'platform' option specified, need to give an instance of ".
       
    16             "\Doctrine\DBAL\Platforms\AbstractPlatform.");
       
    17     }
       
    18 
       
    19     public static function invalidPdoInstance()
       
    20     {
       
    21         return new self(
       
    22             "The 'pdo' option was used in DriverManager::getConnection() but no ".
       
    23             "instance of PDO was given."
       
    24         );
       
    25     }
       
    26 
       
    27     public static function driverRequired()
       
    28     {
       
    29         return new self("The options 'driver' or 'driverClass' are mandatory if no PDO ".
       
    30             "instance is given to DriverManager::getConnection().");
       
    31     }
       
    32 
       
    33     public static function unknownDriver($unknownDriverName, array $knownDrivers)
       
    34     {
       
    35         return new self("The given 'driver' ".$unknownDriverName." is unknown, ".
       
    36             "Doctrine currently supports only the following drivers: ".implode(", ", $knownDrivers));
       
    37     }
       
    38 
       
    39     public static function invalidWrapperClass($wrapperClass)
       
    40     {
       
    41         return new self("The given 'wrapperClass' ".$wrapperClass." has to be a ".
       
    42             "subtype of \Doctrine\DBAL\Connection.");
       
    43     }
       
    44 
       
    45     public static function invalidDriverClass($driverClass)
       
    46     {
       
    47         return new self("The given 'driverClass' ".$driverClass." has to implement the ".
       
    48             "\Doctrine\DBAL\Driver interface.");
       
    49     }
       
    50 
       
    51     /**
       
    52      * @param string $tableName
       
    53      * @return DBALException
       
    54      */
       
    55     public static function invalidTableName($tableName)
       
    56     {
       
    57         return new self("Invalid table name specified: ".$tableName);
       
    58     }
       
    59 
       
    60     /**
       
    61      * @param string $tableName
       
    62      * @return DBALException
       
    63      */
       
    64     public static function noColumnsSpecifiedForTable($tableName)
       
    65     {
       
    66         return new self("No columns specified for table ".$tableName);
       
    67     }
       
    68 
       
    69     public static function limitOffsetInvalid()
       
    70     {
       
    71         return new self("Invalid Offset in Limit Query, it has to be larger or equal to 0.");
       
    72     }
       
    73 
       
    74     public static function typeExists($name)
       
    75     {
       
    76         return new self('Type '.$name.' already exists.');
       
    77     }
       
    78 
       
    79     public static function unknownColumnType($name)
       
    80     {
       
    81         return new self('Unknown column type '.$name.' requested.');
       
    82     }
       
    83 
       
    84     public static function typeNotFound($name)
       
    85     {
       
    86         return new self('Type to be overwritten '.$name.' does not exist.');
       
    87     }
       
    88 }