Project

General

Profile

Feature #93450

Updated by Ayke Halder about 3 years ago

h2. Current state 

 A TypoScript "select":https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Functions/Select.html object must have at least one constraint of @uid@ or @pid@ - configured via properties "uidInList":https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Functions/Select.html#uidinlist and "pidInList":https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Functions/Select.html#pidinlist 


 h2. Feature proposal 

 Allow to completely disable the pid_uid constraint on purpose in ContentObjectRenderer. 

 <pre><code class="javascript"> 
 10 = CONTENT 
 10 { 
    table = 
    select { 
       uidInList = 0 
       pidInList = 0 
    } 
 } 
 </code></pre> 


 h2. Motivation 

 Get records from a m:n-relation where you already know the @uids@ of one side. 
 Tables respresenting m:n-relations do not have a field named @uid@ - instead they have @uid_local@ and @uid_foreign@. 

 As a current work-around you must pre-fill @pidInList@ with *all* @pids@ of the entire database to make this work: 

 <pre><code class="javascript"> 
 pidInList.data = leveluid : 0 
 </code></pre> 

 Example code taken from "tt_content.menu_categorized_content":https://github.com/TYPO3-CMS/fluid_styled_content/blob/7f82e53465a4abec54f5c397c5d1a5d7af78b315/Configuration/TypoScript/ContentElement/MenuCategorizedContent.typoscript#L6-L22 extension "Just News":https://extensions.typo3.org/extension/just_news/ 

 <pre><code class="javascript"> 
 tt_content.menu_categorized_content tt_content { 
     NewsList =< lib.contentElement 
 tt_content.menu_categorized_content 
     NewsList { 
     
         templateName = MenuCategorizedContent 
     NewsList 
         dataProcessing { 
         
             10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor 
         
             10 { 
             
                 table = tt_content 
             pages 
                 pidInList = 1234 
                 selectFields = tt_content.* 
             groupBy pages.* 
                 where = uid 
             pages.doktype = 12 
                 as = news 
                 dataProcessing { 
                     20 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor 
                     20 { 
                         table = sys_category 
                         selectFields = sys_category.title 
                         pidInList.data = leveluid : 0 
             
                         recursive = 99 
             join.data 
                         rightjoin = field:selected_categories 
             join.wrap = sys_category_record_mm ON sys_category_record_mm.uid_local = sys_category.uid 
                         where.field = uid 
                         where.wrap = sys_category_record_mm.tablenames='pages' AND sys_category_record_mm.uid_foreign AND sys_category_record_mm.uid_local IN(|) 
             where.data = field:category_field 
             where.wrap | 
                         begin = tablenames='tt_content' and fieldname='|' 
             orderBy 0 
                         as = tt_content.sorting newsCategories 
                     } 
                 } 
             as = content } 
         } 
     } 
 } 
 </code></pre> 

 h2. Code base 

 "TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer - L6078-L6081":https://github.com/TYPO3-CMS/frontend/blob/2afb96c6725d7751bdb2ca3a53e9566b2eaff52b/Classes/ContentObject/ContentObjectRenderer.php#L6078-L6081 

 <pre><code class="php"> 
         // If not uid and not pid then uid is set to 0 - which results in nothing!! 
         if (!$pid_uid_flag) { 
             $constraints[] = $expressionBuilder->eq($table . '.uid', 0); 
         } 
 </code></pre> 

Back