#93450ContentObjectRenderer: allow TypoScript select object without any constraint of uidInList or pidInList
Description
Current state
A TypoScript select object must have at least one constraint of uid or pid – configured via properties uidInList and pidInList
Feature proposal
Allow to completely disable the pid_uid constraint on purpose in ContentObjectRenderer.
10 = CONTENT
10 {
table =
select {
uidInList = 0
pidInList = 0
}
}
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:
pidInList.data = leveluid : 0
recursive = 99
Example code taken from tt_content.menu_categorized_content
tt_content.menu_categorized_content =< lib.contentElement
tt_content.menu_categorized_content {
templateName = MenuCategorizedContent
dataProcessing {
10 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor
10 {
table = tt_content
selectFields = tt_content.*
groupBy = uid
pidInList.data = leveluid : 0
recursive = 99
join.data = field:selected_categories
join.wrap = sys_category_record_mm ON uid = sys_category_record_mm.uid_foreign AND sys_category_record_mm.uid_local IN(|)
where.data = field:category_field
where.wrap = tablenames='tt_content' and fieldname='|'
orderBy = tt_content.sorting
as = content
}
}
}
Code base
TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer – L6078-L6081
// 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);
}Reviews 1
Related issues 3
History 610
-
Ayke Halder changed Related to #87551 <span data-processor="relativetime" data-value="2021-02-05T18:37:23+00:00" > 02/05/21, 18:37 </span>
-
Ayke Halder commented and changed description <span data-processor="relativetime" data-value="2021-02-05T18:52:40+00:00" > 02/05/21, 18:52 </span>
-
Ayke Halder changed description <span data-processor="relativetime" data-value="2021-02-05T19:01:04+00:00" > 02/05/21, 19:01 </span>
-
Joerg Kummer changed Related to #91718 <span data-processor="relativetime" data-value="2021-02-11T17:35:34+00:00" > 02/11/21, 17:35 </span>
-
Gerrit Code Review pushed patch set 1 for master to change 67912 status
NewUnder Review <span data-processor="relativetime" data-value="2021-02-12T11:29:15+00:00" > 02/12/21, 11:29 </span> -
Gerrit Code Review pushed patch set 2 for master to change 67912 <span data-processor="relativetime" data-value="2021-03-23T12:21:43+00:00" > 03/23/21, 12:21 </span>
-
Gerrit Code Review pushed patch set 3 for master to change 67912 <span data-processor="relativetime" data-value="2021-03-23T16:14:32+00:00" > 03/23/21, 16:14 </span>
-
Jonas Schwabe commented <span data-processor="relativetime" data-value="2021-07-20T13:17:01+00:00" > 07/20/21, 13:17 </span>
I have applied that patch a few days ago because I had the same issue when using a where clause for a record I was not able to reference by uid.
The issue I have been seeing since then: When you have a record that optionally references to something else. When the reference is not filled and an int field is being used the value that is being passed to uidInList is actually 0 and the programmer would not expect that every entry is being fetched from the table.
In our case a random entry was displayed where none was fetched before this patch was applied and field_in_tt_content is 0.
90 = TYPO3\CMS\Frontend\DataProcessing\DatabaseQueryProcessor 90 { as = fluidVariable table = the_table uidInList.field = field_in_tt_content pidInList = 0 }So I’d probably switch to custom logic here and not use DatabaseQueryProcessor if I don’t have a uid or pid that should be listed so existing code doe snot stop working as expected.
-
Gerrit Code Review pushed patch set 4 for main to change 67912 <span data-processor="relativetime" data-value="2021-11-29T13:15:31+00:00" > 11/29/21, 13:15 </span>
-
Benni Mack changed Related to #103179 <span data-processor="relativetime" data-value="2026-11-18T22:03:54+00:00" > 11/18/26, 22:03 </span>
Changed example code to tt_content.menu_categorized_content – also cited in TypoScript Template Reference / Content Objects (cObject) / RECORDS