Search code examples
typo3typo3-extensionstypo3-tca

TYPO3 TCA type "select" performance issue


Is there a possibility to use the TCA field type "select" for a table which has thousands of entries?

The selectbox with the entries shouldn't be displayed (else the record loads minutes or you get a memory limit or max execution time error), but something like a search field (like the existing wizard "suggest") or a record browser (like TCA type "group" has).


Solution

  • It's possible with TCA type "group" and (very important!) setting foreign_table:

    'config' => [
        'type' => 'group',
        'internal_type' => 'db',
        'allowed' => 'fe_users',
        'foreign_table' => 'fe_users'
    ],
    

    From offical documentation (https://docs.typo3.org/typo3cms/TCAReference/ColumnsConfig/Type/Group.html#foreign-table):

    foreign_table: This property does not really exist for group-type fields. It is needed as a workaround for an Extbase limitation. It is used to resolve dependencies during Extbase persistence. It should hold the same values as property allowed. Notice that only one table name is allowed here in contrast to the property allowed itself.