DBALException.php 2.5KB

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