Skip to content

Commit

Permalink
[BUGFIX] Correct foreign_table_where handling
Browse files Browse the repository at this point in the history
When there is an order by in the where clause it is now correctly handled.
Resolves: https://projekte.in2code.de/issues/67832
  • Loading branch information
dhoffmann1979 committed Nov 5, 2024
1 parent e0e1596 commit 2491c7a
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,14 @@ protected function buildResolver(string $table, string $column, array $processed
}
}
$additionalWhere = implode(' AND ', $foreignMatchFields);
$foreignTableWhere = implode(' AND ', array_filter([$foreignTableWhere, $additionalWhere]));
if (1 === preg_match(AbstractProcessor::ADDITIONAL_ORDER_BY_PATTERN, $foreignTableWhere, $matches) && !empty($matches['where'])) {
$foreignTableWhere = implode(' AND ', [$matches['where'], $additionalWhere]);
if (!empty($matches['col'])) {
$foreignTableWhere .= ' ORDER BY ' . $matches['col'] . ($matches['dir'] ?? '');
}
} else {
$foreignTableWhere = implode(' AND ', [$foreignTableWhere, $additionalWhere]);
}
$foreignTableWhere = DatabaseUtility::stripLogicalOperatorPrefix($foreignTableWhere);
$foreignTableWhere = $this->tcaEscapingMarkerService->escapeMarkedIdentifier($foreignTableWhere);

Expand Down

0 comments on commit 2491c7a

Please sign in to comment.