Exception
2 years ago
Visitor
9 months ago
AbstractAsset.php
2 years ago
AbstractSchemaManager.php
9 months ago
Column.php
2 years ago
ColumnDiff.php
2 years ago
Comparator.php
2 years ago
Constraint.php
2 years ago
DB2SchemaManager.php
2 years ago
DefaultSchemaManagerFactory.php
2 years ago
ForeignKeyConstraint.php
9 months ago
Identifier.php
2 years ago
Index.php
2 years ago
LegacySchemaManagerFactory.php
2 years ago
MySQLSchemaManager.php
9 months ago
OracleSchemaManager.php
2 years ago
PostgreSQLSchemaManager.php
9 months ago
SQLServerSchemaManager.php
9 months ago
Schema.php
2 years ago
SchemaConfig.php
2 years ago
SchemaDiff.php
2 years ago
SchemaException.php
2 years ago
SchemaManagerFactory.php
2 years ago
Sequence.php
2 years ago
SqliteSchemaManager.php
8 months ago
Table.php
2 years ago
TableDiff.php
2 years ago
UniqueConstraint.php
2 years ago
View.php
2 years ago
SchemaException.php
90 lines
| 1 | <?php |
| 2 | namespace MailPoetVendor\Doctrine\DBAL\Schema; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | use MailPoetVendor\Doctrine\DBAL\Exception; |
| 5 | use MailPoetVendor\Doctrine\DBAL\Schema\Exception\ColumnAlreadyExists; |
| 6 | use MailPoetVendor\Doctrine\DBAL\Schema\Exception\ColumnDoesNotExist; |
| 7 | use MailPoetVendor\Doctrine\DBAL\Schema\Exception\ForeignKeyDoesNotExist; |
| 8 | use MailPoetVendor\Doctrine\DBAL\Schema\Exception\IndexAlreadyExists; |
| 9 | use MailPoetVendor\Doctrine\DBAL\Schema\Exception\IndexDoesNotExist; |
| 10 | use MailPoetVendor\Doctrine\DBAL\Schema\Exception\IndexNameInvalid; |
| 11 | use MailPoetVendor\Doctrine\DBAL\Schema\Exception\NamedForeignKeyRequired; |
| 12 | use MailPoetVendor\Doctrine\DBAL\Schema\Exception\NamespaceAlreadyExists; |
| 13 | use MailPoetVendor\Doctrine\DBAL\Schema\Exception\SequenceAlreadyExists; |
| 14 | use MailPoetVendor\Doctrine\DBAL\Schema\Exception\SequenceDoesNotExist; |
| 15 | use MailPoetVendor\Doctrine\DBAL\Schema\Exception\TableAlreadyExists; |
| 16 | use MailPoetVendor\Doctrine\DBAL\Schema\Exception\TableDoesNotExist; |
| 17 | use MailPoetVendor\Doctrine\DBAL\Schema\Exception\UniqueConstraintDoesNotExist; |
| 18 | use function sprintf; |
| 19 | class SchemaException extends Exception |
| 20 | { |
| 21 | public const TABLE_DOESNT_EXIST = 10; |
| 22 | public const TABLE_ALREADY_EXISTS = 20; |
| 23 | public const COLUMN_DOESNT_EXIST = 30; |
| 24 | public const COLUMN_ALREADY_EXISTS = 40; |
| 25 | public const INDEX_DOESNT_EXIST = 50; |
| 26 | public const INDEX_ALREADY_EXISTS = 60; |
| 27 | public const SEQUENCE_DOENST_EXIST = 70; |
| 28 | public const SEQUENCE_ALREADY_EXISTS = 80; |
| 29 | public const INDEX_INVALID_NAME = 90; |
| 30 | public const FOREIGNKEY_DOESNT_EXIST = 100; |
| 31 | public const CONSTRAINT_DOESNT_EXIST = 110; |
| 32 | public const NAMESPACE_ALREADY_EXISTS = 120; |
| 33 | public static function tableDoesNotExist($tableName) |
| 34 | { |
| 35 | return TableDoesNotExist::new($tableName); |
| 36 | } |
| 37 | public static function indexNameInvalid($indexName) |
| 38 | { |
| 39 | return IndexNameInvalid::new($indexName); |
| 40 | } |
| 41 | public static function indexDoesNotExist($indexName, $table) |
| 42 | { |
| 43 | return IndexDoesNotExist::new($indexName, $table); |
| 44 | } |
| 45 | public static function indexAlreadyExists($indexName, $table) |
| 46 | { |
| 47 | return IndexAlreadyExists::new($indexName, $table); |
| 48 | } |
| 49 | public static function columnDoesNotExist($columnName, $table) |
| 50 | { |
| 51 | return ColumnDoesNotExist::new($columnName, $table); |
| 52 | } |
| 53 | public static function namespaceAlreadyExists($namespaceName) |
| 54 | { |
| 55 | return NamespaceAlreadyExists::new($namespaceName); |
| 56 | } |
| 57 | public static function tableAlreadyExists($tableName) |
| 58 | { |
| 59 | return TableAlreadyExists::new($tableName); |
| 60 | } |
| 61 | public static function columnAlreadyExists($tableName, $columnName) |
| 62 | { |
| 63 | return ColumnAlreadyExists::new($tableName, $columnName); |
| 64 | } |
| 65 | public static function sequenceAlreadyExists($name) |
| 66 | { |
| 67 | return SequenceAlreadyExists::new($name); |
| 68 | } |
| 69 | public static function sequenceDoesNotExist($name) |
| 70 | { |
| 71 | return SequenceDoesNotExist::new($name); |
| 72 | } |
| 73 | public static function uniqueConstraintDoesNotExist($constraintName, $table) |
| 74 | { |
| 75 | return UniqueConstraintDoesNotExist::new($constraintName, $table); |
| 76 | } |
| 77 | public static function foreignKeyDoesNotExist($fkName, $table) |
| 78 | { |
| 79 | return ForeignKeyDoesNotExist::new($fkName, $table); |
| 80 | } |
| 81 | public static function namedForeignKeyRequired(Table $localTable, ForeignKeyConstraint $foreignKey) |
| 82 | { |
| 83 | return NamedForeignKeyRequired::new($localTable, $foreignKey); |
| 84 | } |
| 85 | public static function alterTableChangeNotSupported($changeName) |
| 86 | { |
| 87 | return new self(sprintf("Alter table change not supported, given '%s'", $changeName)); |
| 88 | } |
| 89 | } |
| 90 |