| Methods |
public
|
__construct(Connection $connection, T $platform)
|
#
|
public
|
getDatabasePlatform(): T
Returns the associated platform.
Returns the associated platform.
Deprecated
Use {@link Connection::getDatabasePlatform()} instead.
|
#
|
public
|
tryMethod(): mixed
Tries any method on the schema manager. Normally a method throws an
exception when your DBMS doesn't support it or if…
Tries any method on the schema manager. Normally a method throws an
exception when your DBMS doesn't support it or if an error occurs.
This method allows you to try and method on your SchemaManager
instance and will return false if it does not work or is not supported.
$result = $sm->tryMethod('dropView', 'view_name');
|
#
|
public
|
listDatabases(): string[]
Lists the available databases for this connection.
Lists the available databases for this connection.
Throws
|
#
|
public
|
listNamespaceNames(): string[]
Returns a list of all namespaces in the current database.
Returns a list of all namespaces in the current database.
Deprecated
Use {@see listSchemaNames()} instead.
Throws
|
#
|
public
|
listSchemaNames(): list<string>
Returns a list of the names of all schemata in the current database.
Returns a list of the names of all schemata in the current database.
Throws
|
#
|
public
|
listSequences(string|null $database = null): Sequence[]
Lists the available sequences for this connection.
Lists the available sequences for this connection.
Throws
|
#
|
public
|
listTableColumns(string $table, string|null $database = null): Column[]
Lists the columns for a given table.
Lists the columns for a given table.
In contrast to other libraries and to the old version of Doctrine,
this column definition does try to contain the 'primary' column for
the reason that it is not portable across different RDBMS. Use
{@see listTableIndexes($tableName)} to retrieve the primary key
of a table. Where a RDBMS specifies more details, these are held
in the platformDetails array.
Parameters
| $table |
The name of the table.
|
Throws
Overriden by
|
#
|
protected
|
doListTableColumns(string $table, string|null $database = null): Column[]
|
#
|
public
|
listTableIndexes(string $table): Index[]
Lists the indexes for a given table returning an array of Index instances.
Lists the indexes for a given table returning an array of Index instances.
Keys of the portable indexes list are all lower-cased.
Parameters
| $table |
The name of the table.
|
Throws
Overriden by
|
#
|
protected
|
doListTableIndexes(string $table): Index[]
|
#
|
public
|
tablesExist(string|string[] $names): bool
Returns true if all the given tables exist.
Returns true if all the given tables exist.
The usage of a string $tableNames is deprecated. Pass a one-element array instead.
Throws
|
#
|
public
|
listTableNames(): string[]
Returns a list of all tables in the current database.
Returns a list of all tables in the current database.
Throws
Overriden by
|
#
|
protected
|
doListTableNames(): list<string>
|
#
|
protected
|
filterAssetNames(mixed[] $assetNames): mixed[]
Filters asset names if they are configured to return only a subset of all
the found elements.
Filters asset names if they are configured to return only a subset of all
the found elements.
|
#
|
public
|
listTables(): list<Table>
Lists the tables for this connection.
Lists the tables for this connection.
Throws
Overriden by
|
#
|
protected
|
doListTables(): list<Table>
|
#
|
public
|
listTableDetails(string $name): Table
Deprecated
Use {@see introspectTable()} instead.
Throws
Overriden by
|
#
|
protected
|
doListTableDetails(string $name): Table
|
#
|
protected
|
normalizeName(string $name): string
An extension point for those platforms where case sensitivity of the object name depends on whether it's quoted.
An extension point for those platforms where case sensitivity of the object name depends on whether it's quoted.
Such platforms should convert a possibly quoted name into a value of the corresponding case.
|
#
|
protected
|
selectTableNames(string $databaseName): Result
Selects names of tables in the specified database.
Selects names of tables in the specified database.
Throws
Overriden by
|
#
|
protected
|
selectTableColumns(string $databaseName, ?string $tableName = null): Result
Selects definitions of table columns in the specified database. If the table name is specified, narrows down
the…
Selects definitions of table columns in the specified database. If the table name is specified, narrows down
the selection to this table.
Throws
Overriden by
|
#
|
protected
|
selectIndexColumns(string $databaseName, ?string $tableName = null): Result
Selects definitions of index columns in the specified database. If the table name is specified, narrows down
the…
Selects definitions of index columns in the specified database. If the table name is specified, narrows down
the selection to this table.
Throws
Overriden by
|
#
|
protected
|
selectForeignKeyColumns(string $databaseName, ?string $tableName = null): Result
Selects definitions of foreign key columns in the specified database. If the table name is specified,
narrows down the…
Selects definitions of foreign key columns in the specified database. If the table name is specified,
narrows down the selection to this table.
Throws
Overriden by
|
#
|
protected
|
fetchTableColumnsByTable(string $databaseName): array<string, list<array<string, mixed>>>
Fetches definitions of table columns in the specified database and returns them grouped by table name.
Fetches definitions of table columns in the specified database and returns them grouped by table name.
Throws
|
#
|
protected
|
fetchIndexColumnsByTable(string $databaseName): array<string, list<array<string, mixed>>>
Fetches definitions of index columns in the specified database and returns them grouped by table name.
Fetches definitions of index columns in the specified database and returns them grouped by table name.
Throws
|
#
|
protected
|
fetchForeignKeyColumnsByTable(string $databaseName): array<string, list<array<string, mixed>>>
Fetches definitions of foreign key columns in the specified database and returns them grouped by table name.
Fetches definitions of foreign key columns in the specified database and returns them grouped by table name.
Throws
|
#
|
protected
|
fetchTableOptionsByTable(string $databaseName, ?string $tableName = null): array<string, array<string, mixed>>
Fetches table options for the tables in the specified database and returns them grouped by table name.
If the table…
Fetches table options for the tables in the specified database and returns them grouped by table name.
If the table name is specified, narrows down the selection to this table.
Throws
Overriden by
|
#
|
public
|
introspectTable(string $name): Table
Introspects the table with the given name.
Introspects the table with the given name.
Throws
|
#
|
public
|
listViews(): View[]
Lists the views this connection has.
Lists the views this connection has.
Throws
|
#
|
public
|
listTableForeignKeys(string $table, string|null $database = null): ForeignKeyConstraint[]
Lists the foreign keys for the given table.
Lists the foreign keys for the given table.
Parameters
| $table |
The name of the table.
|
Throws
Overriden by
|
#
|
protected
|
doListTableForeignKeys(string $table, string|null $database = null): ForeignKeyConstraint[]
|
#
|
public
|
dropDatabase(string $database): void
Drops a database.
Drops a database.
NOTE: You can not drop the database this SchemaManager is currently connected to.
Parameters
| $database |
The name of the database to drop.
|
Throws
|
#
|
public
|
dropSchema(string $schemaName): void
Drops a schema.
|
#
|
public
|
dropTable(string $name): void
Drops the given table.
Parameters
| $name |
The name of the table to drop.
|
Throws
|
#
|
public
|
dropIndex(Index|string $index, Table|string $table): void
Drops the index from the given table.
Drops the index from the given table.
Parameters
| $index |
The name of the index.
|
| $table |
The name of the table.
|
Throws
|
#
|
public
|
dropConstraint(Constraint $constraint, Table|string $table): void
Drops the constraint from the given table.
Drops the constraint from the given table.
Deprecated
Use {@see dropIndex()}, {@see dropForeignKey()} or {@see dropUniqueConstraint()} instead.
Parameters
| $table |
The name of the table.
|
Throws
|
#
|
public
|
dropForeignKey(ForeignKeyConstraint|string $foreignKey, Table|string $table): void
Drops a foreign key from a table.
Drops a foreign key from a table.
Parameters
| $foreignKey |
The name of the foreign key.
|
| $table |
The name of the table with the foreign key.
|
Throws
|
#
|
public
|
dropSequence(string $name): void
Drops a sequence with a given name.
Drops a sequence with a given name.
Parameters
| $name |
The name of the sequence to drop.
|
Throws
|
#
|
public
|
dropUniqueConstraint(string $name, string $tableName): void
Drops the unique constraint from the given table.
Drops the unique constraint from the given table.
Throws
|
#
|
public
|
dropView(string $name): void
Drops a view.
Parameters
| $name |
The name of the view.
|
Throws
|
#
|
public
|
createSchemaObjects(Schema $schema): void
|
#
|
public
|
createDatabase(string $database): void
Creates a new database.
Parameters
| $database |
The name of the database to create.
|
Throws
|
#
|
public
|
createTable(Table $table): void
Creates a new table.
|
#
|
public
|
createSequence(Sequence $sequence): void
Creates a new sequence.
|
#
|
public
|
createConstraint(Constraint $constraint, Table|string $table): void
Creates a constraint on a table.
Creates a constraint on a table.
Deprecated
Use {@see createIndex()}, {@see createForeignKey()} or {@see createUniqueConstraint()} instead.
Throws
|
#
|
public
|
createIndex(Index $index, Table|string $table): void
Creates a new index on a table.
Creates a new index on a table.
Parameters
| $table |
The name of the table on which the index is to be created.
|
Throws
|
#
|
public
|
createForeignKey(ForeignKeyConstraint $foreignKey, Table|string $table): void
Creates a new foreign key.
Creates a new foreign key.
Parameters
| $foreignKey |
The ForeignKey instance.
|
| $table |
The name of the table on which the foreign key is to be created.
|
Throws
|
#
|
public
|
createUniqueConstraint(UniqueConstraint $uniqueConstraint, string $tableName): void
Creates a unique constraint on a table.
Creates a unique constraint on a table.
Throws
|
#
|
public
|
createView(View $view): void
Creates a new view.
|
#
|
public
|
dropSchemaObjects(Schema $schema): void
|
#
|
public
|
dropAndCreateConstraint(Constraint $constraint, Table|string $table): void
Drops and creates a constraint.
Drops and creates a constraint.
Deprecated
Use {@see dropIndex()} and {@see createIndex()},
{@see dropForeignKey()} and {@see createForeignKey()}
or {@see dropUniqueConstraint()} and {@see createUniqueConstraint()} instead.
Throws
|
#
|
public
|
dropAndCreateIndex(Index $index, Table|string $table): void
Drops and creates a new index on a table.
Drops and creates a new index on a table.
Deprecated
Use {@see dropIndex()} and {@see createIndex()} instead.
Parameters
| $table |
The name of the table on which the index is to be created.
|
Throws
|
#
|
public
|
dropAndCreateForeignKey(ForeignKeyConstraint $foreignKey, Table|string $table): void
Drops and creates a new foreign key.
Drops and creates a new foreign key.
Deprecated
Use {@see dropForeignKey()} and {@see createForeignKey()} instead.
Parameters
| $foreignKey |
An associative array that defines properties
of the foreign key to be created.
|
| $table |
The name of the table on which the foreign key is to be created.
|
Throws
|
#
|
public
|
dropAndCreateSequence(Sequence $sequence): void
Drops and create a new sequence.
Drops and create a new sequence.
Deprecated
Use {@see dropSequence()} and {@see createSequence()} instead.
Throws
|
#
|
public
|
dropAndCreateTable(Table $table): void
Drops and creates a new table.
Drops and creates a new table.
Deprecated
Use {@see dropTable()} and {@see createTable()} instead.
Throws
|
#
|
public
|
dropAndCreateDatabase(string $database): void
Drops and creates a new database.
Drops and creates a new database.
Deprecated
Use {@see dropDatabase()} and {@see createDatabase()} instead.
Parameters
| $database |
The name of the database to create.
|
Throws
|
#
|
public
|
dropAndCreateView(View $view): void
Drops and creates a new view.
Drops and creates a new view.
Deprecated
Use {@see dropView()} and {@see createView()} instead.
Throws
|
#
|
public
|
alterSchema(SchemaDiff $schemaDiff): void
Alters an existing schema.
Alters an existing schema.
Throws
|
#
|
public
|
migrateSchema(Schema $toSchema): void
Migrates an existing schema to a new schema.
Migrates an existing schema to a new schema.
Throws
|
#
|
public
|
alterTable(TableDiff $tableDiff): void
Alters an existing tables schema.
Alters an existing tables schema.
Throws
|
#
|
public
|
renameTable(string $name, string $newName): void
Renames a given table to another name.
Renames a given table to another name.
Parameters
| $name |
The current name of the table.
|
| $newName |
The new name of the table.
|
Throws
|
#
|
protected
|
_getPortableDatabasesList(mixed[] $databases): string[]
|
#
|
protected
|
getPortableNamespacesList(array<int, array<string, mixed>> $namespaces): string[]
Converts a list of namespace names from the native DBMS data definition to a portable Doctrine definition.
Converts a list of namespace names from the native DBMS data definition to a portable Doctrine definition.
Deprecated
Use {@see listSchemaNames()} instead.
Parameters
| $namespaces |
The list of namespace names
in the native DBMS data definition.
|
|
#
|
protected
|
_getPortableDatabaseDefinition(mixed $database): mixed
|
#
|
protected
|
getPortableNamespaceDefinition(array<string, mixed> $namespace): mixed
Converts a namespace definition from the native DBMS data definition to a portable Doctrine definition.
Converts a namespace definition from the native DBMS data definition to a portable Doctrine definition.
Deprecated
Use {@see listSchemaNames()} instead.
Parameters
| $namespace |
The native DBMS namespace definition.
|
|
#
|
protected
|
_getPortableSequencesList(mixed[][] $sequences): Sequence[]
|
#
|
protected
|
_getPortableSequenceDefinition(mixed[] $sequence): Sequence
|
#
|
protected
|
_getPortableTableColumnList(string $table, string $database, mixed[][] $tableColumns): Column[]
Independent of the database the keys of the column list result are lowercased.
Independent of the database the keys of the column list result are lowercased.
The name of the created column instance however is kept in its case.
Parameters
| $table |
The name of the table.
|
Throws
|
#
|
abstract
protected
|
_getPortableTableColumnDefinition(mixed[] $tableColumn): Column
Gets Table Column Definition.
Gets Table Column Definition.
Throws
Implemented by
|
#
|
protected
|
_getPortableTableIndexesList(mixed[][] $tableIndexes, string|null $tableName = null): Index[]
Aggregates and groups the index results according to the required data result.
Aggregates and groups the index results according to the required data result.
Throws
Overriden by
|
#
|
protected
|
_getPortableTablesList(mixed[][] $tables): string[]
|
#
|
protected
|
_getPortableTableDefinition(mixed $table): string
|
#
|
protected
|
_getPortableViewsList(mixed[][] $views): View[]
|
#
|
protected
|
_getPortableViewDefinition(mixed[] $view): View|false
|
#
|
protected
|
_getPortableTableForeignKeysList(mixed[][] $tableForeignKeys): ForeignKeyConstraint[]
|
#
|
protected
|
_getPortableTableForeignKeyDefinition(mixed $tableForeignKey): ForeignKeyConstraint
|
#
|
public
|
createSchema(): Schema
Creates a schema instance for the current database.
Creates a schema instance for the current database.
Deprecated
Use {@link introspectSchema()} instead.
Throws
|
#
|
public
|
introspectSchema(): Schema
Returns a {@see Schema} instance representing the current database schema.
Returns a {@see Schema} instance representing the current database schema.
Throws
|
#
|
public
|
createSchemaConfig(): SchemaConfig
Creates the configuration for this schema.
Creates the configuration for this schema.
Throws
|
#
|
public
|
getSchemaSearchPaths(): string[]
The search path for namespaces in the currently connected database.
The search path for namespaces in the currently connected database.
The first entry is usually the default namespace in the Schema. All
further namespaces contain tables/sequences which can also be addressed
with a short, not full-qualified name.
For databases that don't support subschema/namespaces this method
returns the name of the currently connected database.
Throws
|
#
|
private
|
getDatabase(string $methodName): string
|
#
|
public
|
createComparator(): Comparator
|
#
|
private
|
fetchAllAssociativeGrouped(Result $result): array<string, list<array<string, mixed>>>
|
#
|