ArrayParameters
2 years ago
Cache
9 months ago
Driver
9 months ago
Event
2 years ago
Exception
9 months ago
Id
2 years ago
Logging
2 years ago
Platforms
9 months ago
Portability
2 years ago
Query
2 years ago
SQL
9 months ago
Schema
9 months ago
Types
9 months ago
ArrayParameterType.php
2 years ago
ColumnCase.php
2 years ago
Configuration.php
9 months ago
Connection.php
9 months ago
ConnectionException.php
2 years ago
Driver.php
2 years ago
DriverManager.php
2 years ago
Events.php
2 years ago
Exception.php
2 years ago
ExpandArrayParameters.php
2 years ago
FetchMode.php
2 years ago
LockMode.php
2 years ago
ParameterType.php
2 years ago
Query.php
2 years ago
Result.php
2 years ago
Statement.php
2 years ago
TransactionIsolationLevel.php
2 years ago
VersionAwarePlatformDriver.php
2 years ago
index.php
2 years ago
Exception.php
74 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Doctrine\DBAL; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Doctrine\DBAL\Platforms\AbstractPlatform; |
| 5 | use MailPoetVendor\Doctrine\DBAL\Types\Type; |
| 6 | use MailPoetVendor\SensitiveParameter; |
| 7 | use function get_class; |
| 8 | use function gettype; |
| 9 | use function implode; |
| 10 | use function is_object; |
| 11 | use function spl_object_hash; |
| 12 | use function sprintf; |
| 13 | class Exception extends \Exception |
| 14 | { |
| 15 | public static function notSupported(string $method) : self |
| 16 | { |
| 17 | return new self(sprintf("Operation '%s' is not supported by platform.", $method)); |
| 18 | } |
| 19 | public static function invalidPlatformType($invalidPlatform) : self |
| 20 | { |
| 21 | if (is_object($invalidPlatform)) { |
| 22 | return new self(sprintf("Option 'platform' must be a subtype of '%s', instance of '%s' given", AbstractPlatform::class, get_class($invalidPlatform))); |
| 23 | } |
| 24 | return new self(sprintf("Option 'platform' must be an object and subtype of '%s'. Got '%s'", AbstractPlatform::class, gettype($invalidPlatform))); |
| 25 | } |
| 26 | public static function invalidPlatformVersionSpecified(string $version, string $expectedFormat) : self |
| 27 | { |
| 28 | return new self(sprintf('Invalid platform version "%s" specified. ' . 'The platform version has to be specified in the format: "%s".', $version, $expectedFormat)); |
| 29 | } |
| 30 | public static function driverRequired( ?string $url = null) : self |
| 31 | { |
| 32 | if ($url !== null) { |
| 33 | return new self(sprintf("The options 'driver' or 'driverClass' are mandatory if a connection URL without scheme " . 'is given to DriverManager::getConnection(). Given URL: %s', $url)); |
| 34 | } |
| 35 | return new self("The options 'driver' or 'driverClass' are mandatory if no PDO " . 'instance is given to DriverManager::getConnection().'); |
| 36 | } |
| 37 | public static function unknownDriver(string $unknownDriverName, array $knownDrivers) : self |
| 38 | { |
| 39 | return new self("The given 'driver' " . $unknownDriverName . ' is unknown, ' . 'Doctrine currently supports only the following drivers: ' . implode(', ', $knownDrivers)); |
| 40 | } |
| 41 | public static function invalidWrapperClass(string $wrapperClass) : self |
| 42 | { |
| 43 | return new self("The given 'wrapperClass' " . $wrapperClass . ' has to be a ' . 'subtype of \\Doctrine\\DBAL\\Connection.'); |
| 44 | } |
| 45 | public static function invalidDriverClass(string $driverClass) : self |
| 46 | { |
| 47 | return new self("The given 'driverClass' " . $driverClass . ' has to implement the ' . Driver::class . ' interface.'); |
| 48 | } |
| 49 | public static function noColumnsSpecifiedForTable(string $tableName) : self |
| 50 | { |
| 51 | return new self('No columns specified for table ' . $tableName); |
| 52 | } |
| 53 | public static function typeExists(string $name) : self |
| 54 | { |
| 55 | return new self('Type ' . $name . ' already exists.'); |
| 56 | } |
| 57 | public static function unknownColumnType(string $name) : self |
| 58 | { |
| 59 | return new self('Unknown column type "' . $name . '" requested. Any Doctrine type that you use has ' . 'to be registered with \\Doctrine\\DBAL\\Types\\Type::addType(). You can get a list of all the ' . 'known types with \\Doctrine\\DBAL\\Types\\Type::getTypesMap(). If this error occurs during database ' . 'introspection then you might have forgotten to register all database types for a Doctrine Type. Use ' . 'AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement ' . 'Type#getMappedDatabaseTypes(). If the type name is empty you might ' . 'have a problem with the cache or forgot some mapping information.'); |
| 60 | } |
| 61 | public static function typeNotFound(string $name) : self |
| 62 | { |
| 63 | return new self('Type to be overwritten ' . $name . ' does not exist.'); |
| 64 | } |
| 65 | public static function typeNotRegistered(Type $type) : self |
| 66 | { |
| 67 | return new self(sprintf('Type of the class %s@%s is not registered.', get_class($type), spl_object_hash($type))); |
| 68 | } |
| 69 | public static function typeAlreadyRegistered(Type $type) : self |
| 70 | { |
| 71 | return new self(sprintf('Type of the class %s@%s is already registered.', get_class($type), spl_object_hash($type))); |
| 72 | } |
| 73 | } |
| 74 |