Project

General

Profile

Actions

Bug #82100

open

Backend Form Dataprovider load every foreign Entity, not only the related one

Added by Benjamin Rannow over 6 years ago. Updated 5 months ago.

Status:
Under Review
Priority:
Should have
Assignee:
-
Category:
Performance
Target version:
-
Start date:
2017-08-14
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
8
PHP Version:
7.1
Tags:
Complexity:
hard
Is Regression:
Sprint Focus:

Description

Hi,

I notice a massive performance drop if I add in TCA a label_userFunc.
I found the reason in the TYPO3\CMS\Backend\Form\FormDataProvider\AbstractItemProvider::processForeignTableClause

For my Setup

I have 2 Entities Post and Comment, these are Bidirectional Related with ManyToOne.
Post has a inline TCA which load all related Comments.
Comment has a label_userFunc in TCA which simply format a Datetime into the title.

After I Try to Debug the label_userFunc, i notice the method are called WAY TO OFTEN.
Then I look at the Queries. I saw that simply the sql Relation are missing in the Query.

That means every time I want to edit a Post, Typo3 load EVERY Comment from a certain PageId.
Example:
- Post_A has 3 Comments.
- All Posts together conatins over 9000 Comments.

If i want to edit Post_A, I expect that Typo3 Load only 3 Comments, but Actual load Every comment on the System and used on every Comment the label_userFunc.
In the End, i see only 3 comments (which is correct).

I worte myself a little workarund which redurce the system and Database load dramatically:
https://gist.github.com/anonymous/7e307e73e6842fd6d94f28ba62ab2a7d#file-abstractitemprovider-php-L135-L146

Post TCA:

    'comments' => [
            'exclude' => false,
            'l10n_mode' => 'exclude',
            'behaviour' => [
                'allowLanguageSynchronization' => true
            ],
            'label' => $ll . 'backend.tca.post.comments',
            'config' => [
                'type' => 'inline',
                'foreign_table' => 'tx_exampleBlog_domain_model_comments',
                'foreign_field' => 'post',
                'maxitems' => 9999,
                'appearance' => [
                    'collapseAll' => true,
                    'levelLinksPosition' => 'top',
                    'showSynchronizationLink' => false,
                    'showAllLocalizationLink' => false,
                    'showPossibleLocalizationRecords' => true,
                    'showRemovedLocalizationRecords' => true,
                    'enabledControls' => [
                        'info' => true,
                        'dragdrop' => true,
                        'localize' => true,
                    ],
                ],
            ],
        ],

Comment TCA:
    'post' => [
            'exclude' => true,
            'label' => $ll . 'backend.tca.post',
            'config' => [
                'type' => 'select',
                'renderType' => 'selectSingle',
                'foreign_table' => 'tx_exampleBlog_domain_model_post',
                'minitems' => 0,
                'maxitems' => 1,
            ],
        ],


Related issues 3 (2 open1 closed)

Related to TYPO3 Core - Story #54266: As an User I want FAL to be performantClosed2013-11-162013-12-31

Actions
Related to TYPO3 Core - Feature #65505: Add paging for IRRE-records (working with many IRRE-entries)New2015-03-04

Actions
Related to TYPO3 Core - Bug #82730: Opening record in backend painfully slow with foreign table and large main tableUnder Review2017-10-11

Actions
Actions

Also available in: Atom PDF