Bug #59397

Bug #59414: Move all TCA from ext_tables.php to TCA/Overrides for core extensions

Extbase FrontendUser does not work with the TCA caching feature (6.2.1)

Added by Jost Baron over 5 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2014-06-06
Due date:
% Done:

100%

TYPO3 Version:
6.2
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

I use the following code to add a field to the fe_users table:

$newColumns = array( 'ratings' => array( 'label' => $lll . 'somelabel', 'config' => array( 'readOnly' => '1', 'type' => 'select', 'foreign_table' => 'mytable', 'foreign_field' => 'somefield', 'maxitems' => '1000000', 'minitems' => '0', 'autoSizeMax' => '20', ), ), ); ExtensionManagementUtility::addTCAcolumns('fe_users', $newColumns); // Add types to the TCA $recordType = 'MyRecordType'; $GLOBALS['TCA']['fe_users']['types'][$recordType] = $GLOBALS['TCA']['fe_users']['types']['0']; $GLOBALS['TCA']['fe_users']['columns']['tx_extbase_type']['config']['items'][] = array( $lll . 'anotherlabel', $recordType ); ExtensionManagementUtility::addToAllTCAtypes('fe_users', 'ratings', $recordType, 'after:tx_extbase_type');

This does work if used in ext_tables.php, but not if used in Configuration/TCA/Overrides. In the latter case, it seems that the ext_tables.php from Extbase is executed later and overwrites my changes (especially the types part).

Regards Jost

Associated revisions

Revision 382457d2 (diff)
Added by Anja Leichsenring over 5 years ago

[BUGFIX] Move TCA for fe_users and fe_groups into TCA/Overrides

TCA manipulation code must no longer reside in ext_tables.php, but
moved to Configuration/TCA/Overrides/<tablename>.php. Leftovers
in ext_tables might disturb loading order of TCA changes.

Change-Id: Ie919a856fbd8242d19110c8db8d01ff7865c913c
Resolves: #59397
Releases: 6.2
Reviewed-on: https://review.typo3.org/30620
Reviewed-by: Krzysztof Adamczyk
Tested-by: Krzysztof Adamczyk
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter

History

#1 Updated by Anja Leichsenring over 5 years ago

  • Status changed from New to Needs Feedback

Please set in your extension a dependency to extbase. This changes the loading order and should ensure your configuration is the last to be served. Anyway, you are not safe in order to prevent other extensions to override your types again.
Can you test this and give feedback, wheter setting dependency solves the problem?

#2 Updated by Jost Baron over 5 years ago

Hi Anja,

setting the dependency did not help, I tried that already.

#3 Updated by Frans Saris over 5 years ago

Anja,that was my first thought to. But it is the types part that breaks imo. Because the ext_tables.php is renderend every time it overrides the cached values.

Gr. Frans

#4 Updated by Gerrit Code Review over 5 years ago

  • Status changed from Needs Feedback to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30620

#5 Updated by Anja Leichsenring over 5 years ago

Can you please test my patch? It works for me now with the cleanup.
For reference, my <extensionkey>/Configuration/TCA/Overrides/fe_users.php looks like this:

<?php
$recordType = 'MyRecordType';
$tca = array(
    'columns' => array(
        'ratings' => array(
            'label' => $lll . 'somelabel',
            'config' => array(
                'readOnly' => '1',
                'type' => 'select',
                'foreign_table' => 'mytable',
                'foreign_field' => 'somefield',
                'maxitems' => '1000000',
                'minitems' => '0',
                'autoSizeMax' => '20',
            ),
        ),

    ),
    'types' => array(
        $recordType => $GLOBALS['TCA']['fe_users']['types']['0']
    ),
);
$GLOBALS['TCA']['fe_users'] = array_replace_recursive($GLOBALS['TCA']['fe_users'], $tca);
$GLOBALS['TCA']['fe_users']['columns']['tx_extbase_type']['config']['items'][] = array(
    'anotherlabel',
    $recordType
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('fe_users', 'ratings', $recordType, 'after:tx_extbase_type');

#6 Updated by Gerrit Code Review over 5 years ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30620

#7 Updated by Gerrit Code Review over 5 years ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30620

#8 Updated by Gerrit Code Review over 5 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30620

#9 Updated by Gerrit Code Review over 5 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30620

#10 Updated by Gerrit Code Review over 5 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30620

#11 Updated by Gerrit Code Review over 5 years ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/30620

#12 Updated by Anja Leichsenring over 5 years ago

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

#13 Updated by Anja Leichsenring over 5 years ago

  • Parent task set to #59414

#14 Updated by Benni Mack over 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF