DDC-338: Change DQL Parser to comply with ordered collections #418

Closed
opened 2026-01-22 12:37:42 +01:00 by admin · 2 comments
Owner

Originally created by @doctrinebot on GitHub (Feb 14, 2010).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user @beberlei:

This is mostly from DDC-293:

Discussion in IRC had the following results:

* Snippet should be Simple DQL
* Snippet should always be appended to any existing Order By statements, thereby only affecting the emitation of the collection elemets and not any previously requested order
* If the DQL revereses the order previously this should be overwritten, very simple:
1. @orderBy("b.start*year ASC, b.end*year DESC")
2. SELECT a, b FROM a JOIN b ORDER BY b.startYear DESC
1+2 => ORDER BY b.start*year DESC, b.start_year ASC, b.end*year DESC
* In Parser::Join() - Detect ordered collections that are fetch  joined and save this information in _queryComponents.
* In Parser::SelectStatement() - If there exists a query component that has to be ordered, make sure the OrderByClause is created and append the OrderByItems from _queryComponents.
* In SqlWalker::walkOrderByClause the Order By SQL is generated correctly  then.
Originally created by @doctrinebot on GitHub (Feb 14, 2010). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user @beberlei: This is mostly from [DDC-293](http://www.doctrine-project.org/jira/browse/DDC-293): Discussion in IRC had the following results: ``` * Snippet should be Simple DQL * Snippet should always be appended to any existing Order By statements, thereby only affecting the emitation of the collection elemets and not any previously requested order * If the DQL revereses the order previously this should be overwritten, very simple: ``` ``` 1. @orderBy("b.start*year ASC, b.end*year DESC") 2. SELECT a, b FROM a JOIN b ORDER BY b.startYear DESC 1+2 => ORDER BY b.start*year DESC, b.start_year ASC, b.end*year DESC ``` ``` * In Parser::Join() - Detect ordered collections that are fetch joined and save this information in _queryComponents. * In Parser::SelectStatement() - If there exists a query component that has to be ordered, make sure the OrderByClause is created and append the OrderByItems from _queryComponents. * In SqlWalker::walkOrderByClause the Order By SQL is generated correctly then. ```
admin closed this issue 2026-01-22 12:37:43 +01:00
Author
Owner

@doctrinebot commented on GitHub (Feb 20, 2010):

Comment created by @beberlei:

This is now finally implemented, tests for default and CTI use-cases exist.

@doctrinebot commented on GitHub (Feb 20, 2010): Comment created by @beberlei: This is now finally implemented, tests for default and CTI use-cases exist.
Author
Owner

@doctrinebot commented on GitHub (Feb 20, 2010):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Feb 20, 2010): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#418