Bug #62277
openTCA > Config > type group - foreign_table necessary for extbase to work
0%
Description
Having the following TCA for an object:
'config' => array( 'type' => 'group', 'internal_type' => 'db', 'allowed' => 'pages', 'MM' => 'tx_tcteaser_mm', 'MM_insert_fields' => array('tablename' => 'tx_tcteaser_domain_model_teaser'), 'MM_match_fields' => array('tablename' => 'tx_tcteaser_domain_model_teaser'), 'size' => 10, 'minitems' => 0, 'maxitems' => 9999, ),
it works fine in the backend. However, in the frontend, using extbase, all repository calls, ie. findAll(), generates an error, where lastBuiltQuery is this:
SELECT .* FROM tx_tcteaser_mm LEFT JOIN ON tx_tcteaser_mm.uid_foreign = .uid WHERE (tx_tcteaser_mm.uid_local = 1 AND tx_tcteaser_mm.tablename = 'tx_tcteaser_domain_model_teaser') ORDER BY tx_tcteaser_mm.sorting ASC
As you can see, the foreign table is not known.
By adding foreign_table (in this case 'pages') to the config, the error disappears, and everything is fine.
But - foreign_table is not mentioned in the documentation for "group" at all.
Should foreign_table be added OR is this an axtbase bug?
Updated by Mats Nygaard about 10 years ago
Additionally, the documentation for group > mm (http://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Group/Index.html#mm) mentions a required table field "tablenames". This won't work for me, but renaming the field to "tablename" seems to do the job. Actually, "tablename" is mentioned on the same page, here: http://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Group/Index.html#columns-group-data-mm
Again, documentation glitch or code glitch?
Updated by Riccardo De Contardi over 9 years ago
Extbase expects "foreign_table" to contain exactly one table name compared to "allowed" which can hold a list of table names.
(see http://docs.typo3.org/typo3cms/TCAReference/Reference/Columns/Group/Index.html#columns-group-properties-foreign-table)
this limitation is still present in Extbase and will be handled in the future; the documentation about it already got an opened issue (see https://github.com/TYPO3-Documentation/TYPO3CMS-Reference-TCA/pull/36)
Updated by Mathias Schreiber about 9 years ago
- Target version deleted (
next-patchlevel)
Updated by Susanne Moog over 5 years ago
- Has duplicate Task #6249: Support for TCA fields of type "group" - allowes DAM support (has patch) added
Updated by Riccardo De Contardi over 5 years ago
Current documentation link: https://docs.typo3.org/typo3cms/TCAReference/ColumnsConfig/Type/Group.html#foreign-table