DefaultTcaSchema
This class is called by the SchemaMigrator after all extension's ext_tables.sql files have been parsed and processed to the doctrine Table/Column/Index objects.
Method enrich() goes through all $GLOBALS['TCA'] tables and adds fields like 'uid', 'sorting', 'deleted' and friends if the feature is enabled in TCA and the field has not been defined in ext_tables.sql files.
This allows extension developers to leave out the TYPO3 DB management fields and reduce ext_tables.sql of extensions down to the business fields.
Table of Contents
Methods
- enrich() : array<string|int, Table>
- Add fields to $tables array that has been created from ext_tables.sql files.
- getPrioritizedFieldNames() : array<string|int, string>
- If the enrich() method adds fields, they should be added in the beginning of a table.
- enrichMmTables() : array<string|int, mixed>
- Find table fields that configure a "true" MM relation and define the according mm table schema for them. True MM tables are intermediate tables that have NO TCA itself. Those are indicated by type=select and type=group and type=inline fields with MM property.
- enrichSingleTableFields() : mixed
- Add single fields of TCA tables like uid, sorting and similar.
- getTableFirstPosition() : int
- The incoming $tables array can contain Table objects for the same table multiple times. This can happen if an extension has the main CREATE TABLE statement in its ext_tables.sql and another extension adds or changes further fields in an own CREATE TABLE statement.
- isColumnDefinedForTable() : bool
- True if a column with a given name is defined within the incoming array of Table's.
- isIndexDefinedForTable() : bool
- True if an index with a given name is defined within the incoming array of Table's.
- isTableDefined() : bool
- True if table with given table name is defined within incoming $tables array
- quote() : string
Methods
enrich()
Add fields to $tables array that has been created from ext_tables.sql files.
public
enrich(array<string|int, Table> $tables) : array<string|int, Table>
This goes through all tables defined in TCA, looks for 'ctrl' features like "soft delete" ['ctrl']['delete'] and adds the field if it has not been defined in ext_tables.sql, yet.
Parameters
- $tables : array<string|int, Table>
Return values
array<string|int, Table> —Modified tables
getPrioritizedFieldNames()
If the enrich() method adds fields, they should be added in the beginning of a table.
public
getPrioritizedFieldNames(string $tableName) : array<string|int, string>
This has is done for cosmetically reasons to improve readability of db schema when opening tables in a database browser.
Parameters
- $tableName : string
Return values
array<string|int, string>enrichMmTables()
Find table fields that configure a "true" MM relation and define the according mm table schema for them. True MM tables are intermediate tables that have NO TCA itself. Those are indicated by type=select and type=group and type=inline fields with MM property.
protected
enrichMmTables(mixed $tables) : array<string|int, mixed>
Parameters
- $tables : mixed
Return values
array<string|int, mixed>enrichSingleTableFields()
Add single fields of TCA tables like uid, sorting and similar.
protected
enrichSingleTableFields(mixed $tables) : mixed
Parameters
- $tables : mixed
getTableFirstPosition()
The incoming $tables array can contain Table objects for the same table multiple times. This can happen if an extension has the main CREATE TABLE statement in its ext_tables.sql and another extension adds or changes further fields in an own CREATE TABLE statement.
protected
getTableFirstPosition(array<string|int, Table> $tables, string $tableName) : int
Parameters
- $tables : array<string|int, Table>
- $tableName : string
Tags
Return values
intisColumnDefinedForTable()
True if a column with a given name is defined within the incoming array of Table's.
protected
isColumnDefinedForTable(array<string|int, Table> $tables, string $tableName, string $fieldName) : bool
Parameters
- $tables : array<string|int, Table>
- $tableName : string
- $fieldName : string
Return values
boolisIndexDefinedForTable()
True if an index with a given name is defined within the incoming array of Table's.
protected
isIndexDefinedForTable(array<string|int, Table> $tables, string $tableName, string $indexName) : bool
Parameters
- $tables : array<string|int, Table>
- $tableName : string
- $indexName : string
Return values
boolisTableDefined()
True if table with given table name is defined within incoming $tables array
protected
isTableDefined(array<string|int, Table> $tables, string $tableName) : bool
Parameters
- $tables : array<string|int, Table>
- $tableName : string
Return values
boolquote()
protected
quote(string $identifier) : string
Parameters
- $identifier : string