Actions
Bug #80752
openExtbase Repository: No results when joining deleted (hidden, ...) child records
Status:
New
Priority:
Must have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2017-04-07
Due date:
% Done:
0%
Estimated time:
TYPO3 Version:
7
PHP Version:
5.5
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
Description
I have two tables, let's call them parent and child, in a 1:n relation, which I query like this:
$constraints[] = $query->like('title', $q); $constraints[] = $query->like('child.title', $q); $query->matching( $query->logicalOr( $constraints ), );
The generated SQL looks something like this, no problem so far:
SELECT DISTINCT parent.* FROM parent LEFT JOIN child AS child ON parent.uid = child.parent where parent.title LIKE '%query%' OR child.title LIKE '%query%'
Typo3 now adds checks for all the deleted, hidden, ... fields:
AND ((child.deleted=0 AND child.t3ver_state<=0 AND child.pid<>-1 AND child.hidden=0 AND child.starttime<=1491496260 AND (child.endtime=0 OR child.endtime>1491496260)) OR child.uid IS NULL)
If I have a deleted child record, this record gets joined:
LEFT JOIN child AS child ON parent.uid = child.parent
But even if the like query would match, I get no results, because of this:
WHERE ... AND ((child.deleted = 0 ...
I think, this check (and maybe all the hidden, enabled, ... fields too) should be in the join:
LEFT JOIN child AS child ON (parent.uid = child.parent and child.deleted = 0 and child.hidden = 0 AND ...)
Files
Actions