‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema Class Reference

Public Member Functions

Table[] enrich (array $tables)
 

Protected Member Functions

 enrichSingleTableFieldsFromTcaCtrl ($tables)
 
 enrichSingleTableFieldsFromTcaColumns ($tables)
 
 enrichMmTables ($tables)
 
 isColumnDefinedForTable (array $tables, string $tableName, string $fieldName)
 
 isIndexDefinedForTable (array $tables, string $tableName, string $indexName)
 
 getTableFirstPosition (array $tables, string $tableName)
 
 quote (string $identifier)
 

Detailed Description

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.

Definition at line 42 of file DefaultTcaSchema.php.

Member Function Documentation

◆ enrich()

Table [] TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema::enrich ( array  $tables)

Add fields to $tables array that has been created from ext_tables.sql files. 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
Table[]$tables
Returns
‪Table[] Modified tables

Definition at line 53 of file DefaultTcaSchema.php.

References $GLOBALS, TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema\enrichMmTables(), TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema\enrichSingleTableFieldsFromTcaColumns(), and TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema\enrichSingleTableFieldsFromTcaCtrl().

◆ enrichMmTables()

TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema::enrichMmTables (   $tables)
protected

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.

Definition at line 1050 of file DefaultTcaSchema.php.

References $GLOBALS, TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema\getTableFirstPosition(), TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema\isColumnDefinedForTable(), TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema\isIndexDefinedForTable(), and TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema\quote().

Referenced by TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema\enrich().

◆ enrichSingleTableFieldsFromTcaColumns()

◆ enrichSingleTableFieldsFromTcaCtrl()

TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema::enrichSingleTableFieldsFromTcaCtrl (   $tables)
protected

◆ getTableFirstPosition()

TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema::getTableFirstPosition ( array  $tables,
string  $tableName 
)
protected

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.

Todo:
‪It would be better if the incoming $tables structure would be cleaned to contain a table only once before this class is entered.
Parameters
Table[]$tables
Exceptions
DefaultTcaSchemaTablePositionException

Definition at line 1248 of file DefaultTcaSchema.php.

Referenced by TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema\enrichMmTables(), TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema\enrichSingleTableFieldsFromTcaColumns(), and TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema\enrichSingleTableFieldsFromTcaCtrl().

◆ isColumnDefinedForTable()

TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema::isColumnDefinedForTable ( array  $tables,
string  $tableName,
string  $fieldName 
)
protected

◆ isIndexDefinedForTable()

TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema::isIndexDefinedForTable ( array  $tables,
string  $tableName,
string  $indexName 
)
protected

True if an index with a given name is defined within the incoming array of Table's.

Parameters
Table[]$tables

Definition at line 1220 of file DefaultTcaSchema.php.

Referenced by TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema\enrichMmTables(), and TYPO3\CMS\Core\Database\Schema\DefaultTcaSchema\enrichSingleTableFieldsFromTcaCtrl().

◆ quote()