Bug #102708
closedLet queryBuilder support compositeExpression as joinCondition
0%
Description
$queryBuilder->leftJoin
and other joins does not support TYPO3\CMS\Core\Database\Query\Expression\CompositeExpression
as joinCondition. Doing this will result in a 503.
That is really a bug or at least a missing feature, because e. g. mm_matchFields MUST be compared in the joinCondition and NOT in the where-clause. Why? Here is the reason ...
Using a CompositeExpression with mm_matchFields as joinCondition:
A primary record with no partner record in the secondary table is joined with a bunch of NULL fields and is INCLUDED in the result of the join. So a where-clause, reflecting a condition of the primary table COULD MATCH.
Using mm_matchFields in where conditions:
A primary record with no partner record in the secondary table is EXCLUDED from the join result. So a where-clause, reflecting a condition of the primary table will NEVER MATCH.
That's the same problem already solved here for the TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbQueryParser
:
See https://forge.typo3.org/issues/93337#change-493419
$joinConditionExpression = $this->queryBuilder->expr()->and( $basicJoinCondition, $this->getAdditionalMatchFieldsStatement($this->queryBuilder->expr(), $columnMap, $childTableAlias, $realTableName) );
Code example follows ...