PHP 클래스 MetaModels\Helper\TableManipulation

파일 보기 프로젝트 열기: metamodels/core 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$reservedWords string[] List of reserved MySQL identifiers.
$systemColumns string[] When you alter this, ensure to also change @link{TableManipulation::STATEMENT_CREATE_TABLE} above.

공개 메소드들

메소드 설명
addIndex ( string $strTableName, string $strIndexType, string $strColName ) : void Add a index to given tablename for specified columnname
checkColumnDoesNotExist ( string $strTableName, string $strColName, boolean $blnAllowSystemCol = false ) : void Checks whether the given column does not exist.
checkColumnExists ( string $strTableName, string $strColName, boolean $blnAllowSystemCol = false ) : void Checks whether the given table exists.
checkColumnName ( string $strColName, boolean $blnAllowSystemCol = false ) : void Checks whether the column with the given name is not a MetaModel system column and is a valid column name.
checkTableDoesNotExist ( string $strTableName ) : void Ensures that the given table does not exist.
checkTableExists ( string $strTableName ) : void Checks whether the given table exists.
checkTablename ( string $strTableName ) : void Checks whether the given table name is valid.
createColumn ( string $strTableName, string $strColumnName, string $strType, boolean $blnAllowSystemCol = false ) : void Add a column to a table.
createTable ( string $strTableName ) : void Creates a table with the given name.
deleteTable ( string $strTableName ) : void Deletes the table with the given name.
dropColumn ( string $strTableName, string $strColumnName, boolean $blnAllowSystemCol = false ) : void Delete a column from a table.
isReservedWord ( string $word ) : boolean Test if the given word is a reserved MySQL word.
isSystemColumn ( string $strColName ) : boolean Checks whether the column with the given name is a MetaModel system column.
isValidColumnName ( string $strColName ) : boolean Checks whether the column with the given name is a MetaModel system column.
isValidMySQLIdentifier ( string $strName ) : boolean Ensure that an identifier is valid in MySQL context.
isValidTablename ( string $strTableName ) : boolean Checks whether the given table name is valid.
renameColumn ( string $strTableName, string $strColumnName, string $strNewColumnName, string $strNewType, boolean $blnAllowSystemCol = false ) : void Rename a column and/or change it's type in a table.
renameTable ( string $strTableName, string $strNewTableName ) : void Renames a table with the given name to the given new name.
setVariantSupport ( string $strTableName, boolean $blnVariantSupport ) : void Enables or disables Variant support on a certain MetaModel table.

보호된 메소드들

메소드 설명
getDB ( ) : Database Returns the Contao database instance to use.

메소드 상세

addIndex() 공개 정적인 메소드

Add a index to given tablename for specified columnname
public static addIndex ( string $strTableName, string $strIndexType, string $strColName ) : void
$strTableName string The table name.
$strIndexType string The index type.
$strColName string The column name to add a index.
리턴 void

checkColumnDoesNotExist() 공개 정적인 메소드

Checks whether the given column does not exist.
public static checkColumnDoesNotExist ( string $strTableName, string $strColName, boolean $blnAllowSystemCol = false ) : void
$strTableName string The table name to check.
$strColName string The column name to check.
$blnAllowSystemCol boolean If this is set to true, no system column name checking will be applied.
리턴 void

checkColumnExists() 공개 정적인 메소드

Checks whether the given table exists.
public static checkColumnExists ( string $strTableName, string $strColName, boolean $blnAllowSystemCol = false ) : void
$strTableName string The table name to check.
$strColName string The column name to check.
$blnAllowSystemCol boolean If this is set to true, no system column name checking will be applied.
리턴 void

checkColumnName() 공개 정적인 메소드

If there is any problem, an Exception is raised, stating the nature of the error in the Exception message.
public static checkColumnName ( string $strColName, boolean $blnAllowSystemCol = false ) : void
$strColName string The name of the column.
$blnAllowSystemCol boolean If this is set to true, no system column name checking will be applied.
리턴 void

checkTableDoesNotExist() 공개 정적인 메소드

Ensures that the given table does not exist.
public static checkTableDoesNotExist ( string $strTableName ) : void
$strTableName string The table name to check.
리턴 void

checkTableExists() 공개 정적인 메소드

Checks whether the given table exists.
public static checkTableExists ( string $strTableName ) : void
$strTableName string The table name to check.
리턴 void

checkTablename() 공개 정적인 메소드

Checks whether the given table name is valid.
public static checkTablename ( string $strTableName ) : void
$strTableName string The table name to check.
리턴 void

createColumn() 공개 정적인 메소드

Throws Exception if the table does not exist, the column name is invalid or the column already exists.
public static createColumn ( string $strTableName, string $strColumnName, string $strType, boolean $blnAllowSystemCol = false ) : void
$strTableName string The name of the table to add the column to.
$strColumnName string The name of the new column.
$strType string The SQL type notation of the new column.
$blnAllowSystemCol boolean If this is set to true, no system column name checking will be applied.
리턴 void

createTable() 공개 정적인 메소드

Creates a table with the given name.
public static createTable ( string $strTableName ) : void
$strTableName string The name of the new table to create.
리턴 void

deleteTable() 공개 정적인 메소드

Deletes the table with the given name.
public static deleteTable ( string $strTableName ) : void
$strTableName string The name of the new table to delete.
리턴 void

dropColumn() 공개 정적인 메소드

Throws Exception if the table does not exist, the column name is invalid or the column does not exist.
public static dropColumn ( string $strTableName, string $strColumnName, boolean $blnAllowSystemCol = false ) : void
$strTableName string The name of the table the column is in.
$strColumnName string The name of the column to drop.
$blnAllowSystemCol boolean If this is set to true, no system column name checking will be applied.
리턴 void

getDB() 보호된 정적인 메소드

Returns the Contao database instance to use.
protected static getDB ( ) : Database
리턴 Database the database instance.

isReservedWord() 공개 정적인 메소드

Test if the given word is a reserved MySQL word.
public static isReservedWord ( string $word ) : boolean
$word string The word to test.
리턴 boolean

isSystemColumn() 공개 정적인 메소드

Checks whether the column with the given name is a MetaModel system column.
public static isSystemColumn ( string $strColName ) : boolean
$strColName string The name of the column.
리턴 boolean true if the column is a system column, false otherwise.

isValidColumnName() 공개 정적인 메소드

Checks whether the column with the given name is a MetaModel system column.
public static isValidColumnName ( string $strColName ) : boolean
$strColName string The name of the column.
리턴 boolean true if the column is a system column, false otherwise.

isValidMySQLIdentifier() 공개 정적인 메소드

Ensure that an identifier is valid in MySQL context.
public static isValidMySQLIdentifier ( string $strName ) : boolean
$strName string The identifier to check.
리턴 boolean

isValidTablename() 공개 정적인 메소드

Checks whether the given table name is valid.
public static isValidTablename ( string $strTableName ) : boolean
$strTableName string The table name to check.
리턴 boolean true if the table name is valid, false otherwise.

renameColumn() 공개 정적인 메소드

Throws Exception if the table does not exist, the column name is invalid or the column already exists.
public static renameColumn ( string $strTableName, string $strColumnName, string $strNewColumnName, string $strNewType, boolean $blnAllowSystemCol = false ) : void
$strTableName string The name of the table the column is in.
$strColumnName string The current name of the column to be renamed.
$strNewColumnName string The new name for the column.
$strNewType string The new SQL type notation of the column.
$blnAllowSystemCol boolean If this is set to true, no system column name checking will be applied.
리턴 void

renameTable() 공개 정적인 메소드

Renames a table with the given name to the given new name.
public static renameTable ( string $strTableName, string $strNewTableName ) : void
$strTableName string The name of the table to rename.
$strNewTableName string The name to which the table shall be renamed to.
리턴 void

setVariantSupport() 공개 정적인 메소드

Enables or disables Variant support on a certain MetaModel table.
public static setVariantSupport ( string $strTableName, boolean $blnVariantSupport ) : void
$strTableName string The table name of the MetaModel.
$blnVariantSupport boolean Flag if the support shall be turned on or off.
리턴 void

프로퍼티 상세

$reservedWords 보호되어 있는 정적으로 프로퍼티

List of reserved MySQL identifiers.
protected static string[] $reservedWords
리턴 string[]

$systemColumns 보호되어 있는 정적으로 프로퍼티

When you alter this, ensure to also change @link{TableManipulation::STATEMENT_CREATE_TABLE} above.
protected static string[] $systemColumns
리턴 string[]