Common fields

Mandatory fields

All data tables with a TCA definition need to have at least the following fields defined in the ext_tables.sql:

EXT:my_extension/ext_tables.sql
CREATE TABLE tx_myextension_domain_model_something (
   uid          INT(11)                 NOT NULL AUTO_INCREMENT,
   pid          INT(11) DEFAULT '0'     NOT NULL,
)

There is no separate definition of these fields in the TCA configuration. It is not possible to use different names for these fields.

Fields used by convention

Warning

It is possible to change the names of the following fields, however this is strongly discouraged as it breaks convention and may lead to compatibility issues with third party extensions.

All fields mentioned below get added to the database automatically. It is not recommended to define them in the ext_tables.sql. Doing so with incompatible SQL settings can lead to problems later on.

Soft delete

deleted

This field is used to enable soft delete in records. In can be configured by setting ctrl->deleted:

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php
return [
    'ctrl' => [
        'delete' => 'deleted',
        // ...
    ],
];

Warning

If no deleted field is configured, records will be hard deleted. The DataHandler in the backend and Extbase will automatically execute DELETE statements.

The deleted field is never directly visible in backend forms. It is handled separately by the DataHandler. Therefore it needs no definition in the columns section.

Enablecolumns

hidden

This field is used to enable soft hiding of records. In can be configured by setting ctrl->enablecolumns->disabled:

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php
return [
    'ctrl' => [
        'enablecolumns' => [
            'disabled' => 'hidden',
        ],
        // ...
    ],
    'columns' => [
        'hidden' => [
            'exclude' => true,
            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.enabled',
            'config' => [
                'type' => 'check',
                'renderType' => 'checkboxToggle',
                'items' => [
                    [
                        0 => '',
                        1 => '',
                        'invertStateDisplay' => true
                    ]
                ],
            ]
        ],
        // ...
    ],
];
starttime and endtime

This field is used to enable records by a starttime and or disable them with an endtime. In can be configured by ctrl->enablecolumns->starttime or endtime:

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'enablecolumns' => [
            'disabled' => 'hidden',
            'starttime' => 'starttime',
            'endtime' => 'endtime',
        ],
        // ...
    ],
   'columns' => [
        'starttime' => [
            'exclude' => true,
            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime',
            'config' => [
                'type' => 'datetime',
                'default' => 0,
            ],
            'l10n_mode' => 'exclude',
            'l10n_display' => 'defaultAsReadonly',
        ],
        'endtime' => [
            'exclude' => true,
            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime',
            'config' => [
                'type' => 'datetime',
                'default' => 0,
                'range' => [
                    'upper' => mktime(0, 0, 0, 1, 1, 2038),
                ],
            ],
            'l10n_mode' => 'exclude',
            'l10n_display' => 'defaultAsReadonly',
        ],
   ],
];
fe_group

This field is used to enable soft delete of records. In can be configured by ctrl->enablecolumns->fe_group:

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'enablecolumns' => [
            'fe_group' => 'fe_group',
        ],
        // ...
    ],
    'columns' => [
        'fe_group' => [
            'exclude' => true,
            'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.fe_group',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectMultipleSideBySide',
                'size' => 5,
                'maxitems' => 20,
                'items' => [
                    [
                        'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.hide_at_login',
                        -1,
                    ],
                    [
                        'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.any_login',
                        -2,
                    ],
                    [
                        'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.usergroups',
                        '--div--',
                    ],
                ],
                'exclusiveKeys' => '-1,-2',
                'foreign_table' => 'fe_groups',
            ],
        ],
        // ...
    ],
];

Warning

These enable fields are only respected in the frontend if you use proper queries or Extbase repository settings in your extensions code. See Enablecolumns / enablefields usage for more information.

Manual sorting in the backend

sorting

This field is used to manually sort records in the backend. In can be configured by ctrl->sortby:

EXT:my_extension/Configuration/TCA/tx_myextension_domain_model_something.php
<?php

return [
    'ctrl' => [
        'sortby' => 'sorting',
    ],
];

Attention

The sortby field contains an integer and is managed by the DataHandler. It therefore should have no definition in the columns section. Any value in this field can be changed at any time by the DataHandler.

Use default_sortby if you want to sort by an existing field of the domain instead.

Fields managed by the DataHandler

The following fields are automatically set when a record is written by the DataHandler. They should never be displayed in backend forms or explicitly set, therefore they need no entry in the columns section of the TCA.

EXT:my_extension/Configuration/Backend/BackendAjaxRoutes.php
<?php

return [
    'ctrl' => [
        'tstamp' => 'tstamp',
        'crdate' => 'crdate',
        'cruser_id' => 'cruser_id',
        'origUid' => 't3_origuid',
        // ...
    ],
];
tstamp

This field is automatically updated to the current timestamp each time the record is updated or saved in the DataHandler.

It can be configured by setting ctrl->tstamp.

crdate

This field is automatically set to the current timestamp if the record is created by the DataHandler.

It can be configured by setting ctrl->crdate.

cruser_id

This field is automatically set to the uid of the backend user who originally created the record if the record is created by the DataHandler.

It can be configured by setting ctrl->cruser_id.

t3_origuid

Field name, which contains the uid of the original record in case a record is created as a copy or new version of another record.

It can be configured by setting ctrl->cruser_id.