Attention
TYPO3 v11 has reached end-of-life as of October 31th 2024 and is no longer being maintained. Use the version switcher on the top left of this page to select documentation for a supported version of TYPO3.
Need more time before upgrading? You can purchase Extended Long Term Support (ELTS) for TYPO3 v10 here: TYPO3 ELTS.
relationship
relationship
-
- Type
- string
- Path
- $GLOBALS['TCA'][$table]['columns'][$field]['config']
- Scope
- Display / Proc.
- RenderType
- all
- Default
- manyToMany
All possible values are:
one
To One - Stores the uid of the selected category. When using this
relationship,
maxitems=1
will automatically be added to the column configuration. While one record can only have a relation to one category, each category can still have a relationship to more then one record. one
To Many - Stores the uids of selected categories in a comma-separated list.
many
(default):To Many - Uses the intermediate table
sys_
and only stores the categories count on the local side. This is the use case, which was previously accomplished usingcategory_ record_ mm Extension
.Management Utility->make Categorizable ()
In the following example a category tree is displayed, but only one category can be selected.
$GLOBALS['TCA'][$myTable]['columns']['mainCategory'] = [ 'config' => [ 'type' => 'category', 'relationship' => 'oneToOne' ] ];
Copied!All other relevant options, for example
maxitems=1
, are being set automatically.