Bug #103025
closedUndefined array index for TCA without ctrl
100%
Description
I have an extension that uses a TCA configuration without the ctrl part because I don't need it. In my specific case I created a TCA configuration for the table "sys_registry":
<?php
declare(strict_types=1);
return [
'columns' => [
'entry_namespace' => [
'label' => 'LLL:EXT:registry_editor/Resources/Private/Language/locallang_tca.xlf:sys_registry.entry_namespace',
'config' => [
'type' => 'input',
'size' => 50,
'max' => 128,
],
],
'entry_key' => [
'label' => 'LLL:EXT:registry_editor/Resources/Private/Language/locallang_tca.xlf:sys_registry.entry_key',
'config' => [
'type' => 'input',
'size' => 50,
'max' => 128,
],
],
'entry_value' => [
'label' => 'LLL:EXT:registry_editor/Resources/Private/Language/locallang_tca.xlf:sys_registry.entry_value',
'config' => [
'type' => 'passthrough',
],
],
],
];
that I need to access the database via extbase but nothing more as the table should not be listed in the backend list view.
If I add:
'ctrl' => [],
my code breaks because then the core tries to add a "pid" to the query but that table doeesn't have a "pid".
Updated by Gerrit Code Review 10 months ago
- Status changed from New to Under Review
Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82771
Updated by Stefan Bürk 10 months ago · Edited
`sys_registry` is not TCA controlled by intention. Adding a TCA definition for it comes with some impact.
First, a `pid` column would be added through the database analyser / Default TCA Schema logic.
You are right with the place and that it should be covered, but you are messing around with something
not intended.
However, the bugfix is okay.
TCA controlled tables should have a uid and pid. point. (mm relation tables are a special case). Tables
not falling into that schema are not suitable to be TCA managed.
I'd argue that a TCA managed table without a ctrl section is broken anyway.
Updated by Simon Schaufelberger 10 months ago
My code may not be optimal but I basically do almost the same like the backend user module, just for registry entries for my registry editor extension: https://www.simonschaufelberger.de/de/shop.html
I could rewrite the "findDemanded" method to use the Doctrine QueryBuilder instead of the extbase one, I just found this more convenient ;) Then I could probably drop the TCA config completely.
Updated by Gerrit Code Review 10 months ago
Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82771
Updated by Simon Schaufelberger 10 months ago
- TYPO3 Version changed from 12 to 11
Updated by Gerrit Code Review 10 months ago
Patch set 3 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82771
Updated by Gerrit Code Review 10 months ago
Patch set 4 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82771
Updated by Gerrit Code Review 10 months ago
Patch set 5 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82771
Updated by Gerrit Code Review 10 months ago
Patch set 6 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82771
Updated by Gerrit Code Review 10 months ago
Patch set 7 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82771
Updated by Gerrit Code Review 10 months ago
Patch set 8 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82771
Updated by Gerrit Code Review 10 months ago
Patch set 9 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82771
Updated by Gerrit Code Review 10 months ago
Patch set 10 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82771
Updated by Stefan Bürk 10 months ago
Simon Schaufelberger wrote in #note-4:
My code may not be optimal but I basically do almost the same like the backend user module, just for registry entries for my registry editor extension: https://www.simonschaufelberger.de/de/shop.html
I could rewrite the "findDemanded" method to use the Doctrine QueryBuilder instead of the extbase one, I just found this more convenient ;) Then I could probably drop the TCA config completely.
If you do so add a ctrl section. I'd argue that at least the title configuration should be set, https://docs.typo3.org/m/typo3/reference-tca/main/en-us/Ctrl/Properties/Title.html#title ... and in case of sys_registry also https://docs.typo3.org/m/typo3/reference-tca/main/en-us/Ctrl/Properties/HideTable.html#hidetable should be set.
As already mentioned, the database analyzer will add a `pid` field to the table in case you add a TCA configuration for this field.
And still, `sys_registry` is not ment to be TCA controlled. Adding it to be used with extbase is here out of the scope and you are messing arround with a TYPO3 core table in a way which is not intented - and open for sideeffects.
Updated by Gerrit Code Review 10 months ago
Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82790
Updated by Gerrit Code Review 10 months ago
Patch set 2 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82790
Updated by Gerrit Code Review 10 months ago
Patch set 3 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82790
Updated by Gerrit Code Review 10 months ago
Patch set 4 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82790
Updated by Gerrit Code Review 10 months ago
Patch set 1 for branch 11.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/82792
Updated by Anonymous 10 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 86f637579f663d34e9690f78a6e18dc237b37010.