Bug #77862

TYPO3 function select properties max and begin special keyword "total" not working with joined tables

Added by Sinisa Mitrovic almost 6 years ago. Updated 11 months ago.

Status:
New
Priority:
Could have
Assignee:
-
Category:
TypoScript
Target version:
-
Start date:
2016-09-06
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

Properties max and begin inside select function have special keyword "total" which should have total number of records.
In getQuery function in \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer first is to set limit and after that if there is no errors setting up table joins.
Limit use $queryParts['where'] and it cause problem if in where clause of select we have condition on joined table.
Here is example:

lib.someContent = CONTENT
lib.someContent {
table = tx_extension_domain_model_model2
select {
pidInList = 1
join = tx_extension_model1_model2_mm ON tx_extension_model1_model2_mm.uid_foreign = tx_extension_domain_model_model2.uid
where = tx_extension_model1_model2_mm.uid_local = 1
max = total - 1
}
}

In this example we will have error like unknown column tx_extension_model1_model2_mm.uid_local because in this step tables are not joined yet.

#1

Updated by Riccardo De Contardi 11 months ago

On the latest documentation

https://docs.typo3.org/m/typo3/reference-typoscript/master/en-us/Functions/Select.html#max

I've found the line:

Special keyword: “total” is substituted with count(*) .

I don't know if this affects this issue...

Also available in: Atom PDF