Project

General

Profile

Bug #82100

Updated by Benjamin Rannow over 7 years ago

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: 
 <pre> 
	 '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, 
                     ], 
                 ], 
             ], 
         ], 
 </pre> 
 Comment TCA: 
 <pre> 
	 'post' => [ 
             'exclude' => true, 
             'label' => $ll . 'backend.tca.post', 
             'config' => [ 
                 'type' => 'select', 
                 'renderType' => 'selectSingle', 
                 'foreign_table' => 'tx_exampleBlog_domain_model_post', 
                 'minitems' => 0, 
                 'maxitems' => 1, 
             ], 
         ], 
 </pre>

Back