com\setasign\SetaFramework\Database\Manager

AbstractManager Class AbstractManager

File: /SetaFramework/src/Database/Manager/AbstractManager.php

Class hierarchy

Summary

Properties


Methods

dropTable()

abstract public AbstractManager::dropTable (
string $tableName
): void

Drops a table.

Parameters
$tableName : string
 

getAlterDefinition()

abstract public AbstractManager::getAlterDefinition (
string $originalTableName,
array{columnOrder: string[], addColumns: Column\AbstractColumn[], modifyColumns: Column\AbstractColumn[], changeColumns: array<string, array{oldName: string, column: Column\AbstractColumn}>, dropColumns: string[], addKeys: array<string, array{type: string, columns: string[]}>, dropKeys: string[], changeTableName: string|false, changeEngine: string|false, changeTableCollation: string|false} $changes
): string

Returns the sql command for alter the table.

$changes: all entries are arrays, following keys are used:

KeyDescription
addColumns & modifyColumnsvalue = AbstractColumn $column
changeColumnskey = string $oldColumnName; value = AbstractColumn $column
dropColumnsvalue = string $columnName
addKeyskey = string $indexName; value = array('type' => int $indexType; 'columns' => string[] $columns)
dropKeysvalue = string $indexName
Parameters
$originalTableName : string
 
$changes : array{columnOrder: string[], addColumns: Column\AbstractColumn[], modifyColumns: Column\AbstractColumn[], changeColumns: array<string, array{oldName: string, column: Column\AbstractColumn}>, dropColumns: string[], addKeys: array<string, array{type: string, columns: string[]}>, dropKeys: string[], changeTableName: string|false, changeEngine: string|false, changeTableCollation: string|false}
 

getColumnDefinition()

abstract public AbstractManager::getColumnDefinition (): string

Returns the column definition for the column as string.

Should be used in getCreateDefinition and getAlterDefinition.

Parameters
$column : Column\AbstractColumn
 

getCreateDefinition()

abstract public AbstractManager::getCreateDefinition (
TableSchema $tableSchema,
bool $ifNotExist = false
): string

Returns the sql command for creating the table

Parameters
$tableSchema : TableSchema
 
$ifNotExist : bool
 

getDatabase()

Returns the database instance.

getDefaultCollation()

abstract public AbstractManager::getDefaultCollation (
void
): string

getDefaultEngine()

abstract public AbstractManager::getDefaultEngine (
void
): ?string

Returns the table engine.

getTableNames()

abstract public AbstractManager::getTableNames (
void
): array

Return the names of all tables in the database.

getTableSchema()

abstract public AbstractManager::getTableSchema (
string $tableName
): TableSchema

Returns the tableSchema for the table.

The table must already exist in the database.

Parameters
$tableName : string
 

hasColumn()

abstract public AbstractManager::hasColumn (
string $tableName,
string $column
): bool

Checks whether a column exists (with as little overhead as possible).

Note: the table must exist.

Parameters
$tableName : string
 
$column : string
 

hasTable()

abstract public AbstractManager::hasTable (
string $tableName
): bool

Checks whether a table exist.

Parameters
$tableName : string
 

renameTable()

abstract public AbstractManager::renameTable (
string $oldTableName,
string $newTableName
): void

Renames a table.

Mustn't be used if there exists a tableSchema for the table! (Only in TableSchema::rename)

Parameters
$oldTableName : string
 
$newTableName : string