TcaSchemaFactory

Create Schema objects from information stored in TCA.

A TcaSchema contains:

  • a list of all fields as defined in [columns]
  • a list of "capabilities" (parts defined in the [ctrl] section)
  • a list of sub-schemata (if there is a [ctrl][type] definition, then sub-schemata are instances of TcaSchema itself again)
  • a list of possible relations of other schemata pointing to this schema ("Passive Relations")

As the relations need to be fully resolved first (done in RelationMapBuilder), the TcaSchemaFactory does two-step processing: 1a. Traverse TCA (and, if type=flex parts are registered), and find relations of all TCA parts pointing to each other 1b. Store this in a RelationMap object as a multi-level array.

  1. Loop through all TCA tables one by one 2a. Build field objects for the TCA table. 2b. Detect "sub schemata" (if [ctrl][type] is set), build the field objects only relevant for the sub-schema 2c. Build the sub-schema 2d. Build the main schema

This is done that way to ensure that all objects can not be modified anymore, and we have a complete representation of the data structures available.

Internal

This is an experimental implementation and might change until TYPO3 v13 LTS

Attributes
#[Autoconfigure]
$public: true
$shared: true

Table of Contents

Properties

$cache  : PhpFrontend
$cacheIdentifier  : string
$fieldTypeFactory  : FieldTypeFactory
$relationMapBuilder  : RelationMapBuilder
$schemata  : array<string|int, mixed>

Methods

__construct()  : mixed
all()  : SchemaCollection<string, TcaSchema>
Returns all main schemata
get()  : TcaSchema
Get a schema from the loaded TCA. Ensure to check for a schema with ->has() before calling ->get().
has()  : bool
Checks if a schema exists, does not build the schema if not needed, thus it's very slim and only creates a schema if a sub-schema is requested.
load()  : void
Load TCA and populate all schema - throws away existing schema if $force is set.
rebuild()  : void
Only used for functional tests, which override TCA on the fly for specific test cases.
warmupCaches()  : void
build()  : TcaSchema
Builds a schema from a TCA table, if a sub-schema is requested, it will build the main schema and all sub-schematas first.
findRelevantFieldsForSubSchema()  : array<string|int, mixed>
getFinalFieldConfiguration()  : array<string|int, mixed>
Handles the label and possible columnsOverrides

Properties

$cacheIdentifier read-only

protected string $cacheIdentifier
Attributes
#[Autowire]
$expression: 'service("package-dependent-cache-identifier").withPrefix("TcaSchema").toString()'

$schemata

protected array<string|int, mixed> $schemata = []

Methods

get()

Get a schema from the loaded TCA. Ensure to check for a schema with ->has() before calling ->get().

public get(string $schemaName) : TcaSchema
Parameters
$schemaName : string
Return values
TcaSchema

has()

Checks if a schema exists, does not build the schema if not needed, thus it's very slim and only creates a schema if a sub-schema is requested.

public has(string $schemaName) : bool
Parameters
$schemaName : string
Return values
bool

load()

Load TCA and populate all schema - throws away existing schema if $force is set.

public load(array<string|int, mixed> $tca[, bool $force = false ]) : void
Parameters
$tca : array<string|int, mixed>
$force : bool = false
Internal

only used for TYPO3 Core internally, never use it in public!

rebuild()

Only used for functional tests, which override TCA on the fly for specific test cases.

public rebuild(array<string|int, mixed> $fullTca) : void

Modifying TCA other than in Configuration/TCA/Overrides must be avoided in production code.

Parameters
$fullTca : array<string|int, mixed>
Internal

only used for TYPO3 Core internally, never use it in public!

build()

Builds a schema from a TCA table, if a sub-schema is requested, it will build the main schema and all sub-schematas first.

protected build(string $schemaName, array<string|int, mixed> $fullTca, RelationMap $relationMap) : TcaSchema

First builds all fields, then the schema and attach the fields, so all parts can never be modified (except for adding sub-schema - this might be removed at some point hopefully).

Then, resolves the sub-schema and the relevant fields for there with columnsOverrides taken into account.

As it is crucial to understand, parts such as FlexForms (incl. Sheet, SectionContainers and their Fields) NEED to be resolved first, because they need to be attached.

Parameters
$schemaName : string
$fullTca : array<string|int, mixed>
$relationMap : RelationMap
Return values
TcaSchema

findRelevantFieldsForSubSchema()

protected findRelevantFieldsForSubSchema(array<string|int, mixed> $tcaForTable, string $subSchemaName) : array<string|int, mixed>
Parameters
$tcaForTable : array<string|int, mixed>
$subSchemaName : string
Return values
array<string|int, mixed>

getFinalFieldConfiguration()

Handles the label and possible columnsOverrides

protected getFinalFieldConfiguration(string $fieldName, array<string|int, mixed> $schemaConfiguration, array<string|int, mixed> $subSchemaConfiguration, string|null $fieldLabel) : array<string|int, mixed>
Parameters
$fieldName : string
$schemaConfiguration : array<string|int, mixed>
$subSchemaConfiguration : array<string|int, mixed>
$fieldLabel : string|null
Return values
array<string|int, mixed>

        
On this page

Search results