Project

General

Profile

Actions

Bug #105418

open

QueryBuilder: no longer possible to build advanced orderings with orderBy

Added by Michael Stopp 8 days ago. Updated 2 days ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2024-10-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
13
PHP Version:
8.2
Tags:
queryBuilder
Complexity:
Is Regression:
Sprint Focus:

Description

I'm basically repeating myself from 6 years ago (#84814): with the current QueryBuilder it seems impossible to do orderings that go beyond simple field list, i.e. something like in these real-life examples:

ORDER BY FIELD(eventtype, 0, 4, 1, 2, 3), sorting

or

ORDER BY CAST(SUBSTRING_INDEX(c.IP, '.', -1) AS UNSIGNED)

Before moving to Doctrine DBAL version 4 it was possible to achieve this with something like:

$queryBuilder->add('orderBy', 'FIELD(eventtype, 0, 4, 1, 2, 3), sorting')

How can we do this now, after the add() method was dropped in DBAL v4?

Actions

Also available in: Atom PDF