#102708Let queryBuilder support compositeExpression as joinCondition
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 …
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.