Project

General

Profile

Actions

Bug #103025

closed

Undefined array index for TCA without ctrl

Added by Simon Schaufelberger 3 months ago. Updated 3 months ago.

Status:
Resolved
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2024-02-02
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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".

Actions #1

Updated by Simon Schaufelberger 3 months ago

  • Description updated (diff)
Actions #2

Updated by Gerrit Code Review 3 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

Actions #3

Updated by Stefan Bürk 3 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.

Actions #4

Updated by Simon Schaufelberger 3 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.

Actions #5

Updated by Gerrit Code Review 3 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

Actions #6

Updated by Simon Schaufelberger 3 months ago

  • TYPO3 Version changed from 12 to 11
Actions #7

Updated by Gerrit Code Review 3 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

Actions #8

Updated by Gerrit Code Review 3 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

Actions #9

Updated by Gerrit Code Review 3 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

Actions #10

Updated by Gerrit Code Review 3 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

Actions #11

Updated by Gerrit Code Review 3 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

Actions #12

Updated by Gerrit Code Review 3 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

Actions #13

Updated by Gerrit Code Review 3 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

Actions #14

Updated by Gerrit Code Review 3 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

Actions #15

Updated by Stefan Bürk 3 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.

Actions #16

Updated by Gerrit Code Review 3 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

Actions #17

Updated by Gerrit Code Review 3 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

Actions #18

Updated by Gerrit Code Review 3 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

Actions #19

Updated by Gerrit Code Review 3 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

Actions #20

Updated by Gerrit Code Review 3 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

Actions #21

Updated by Anonymous 3 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF