Doctrine places joined element OrderBy clause in another element's juncture condition's subQuery #5880

Open
opened 2026-01-22 15:21:05 +01:00 by admin · 1 comment
Owner

Originally created by @Cedoriku on GitHub (Feb 13, 2018).

Hello,

I am having an issue with a multiple junctures query, in which one (a) is based on a subquery condition with an order by clause, and another (b) has an orderBy clause specified in the entity's attribute annotation.

What happens is that Doctrine adds the b orderby clause to the the one in the subquery, where there is no b in scope, instead of putting it in the main query, where it belongs. Basically this results in an SQL error:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'u7_.level' in 'order clause'

.. seems legit..

Here is my thread on Stackoverflow with the complete explanation:
https://stackoverflow.com/questions/48684549/dql-query-doctrine-places-joined-element-orderby-clause-in-another-elements-jun

Every juncture is attached to the same main entity.

Originally created by @Cedoriku on GitHub (Feb 13, 2018). Hello, I am having an issue with a multiple junctures query, in which one (a) is based on a subquery condition with an order by clause, and another (b) has an orderBy clause specified in the entity's attribute annotation. What happens is that Doctrine adds the b orderby clause to the the one in the subquery, where there is no b in scope, instead of putting it in the main query, where it belongs. Basically this results in an SQL error: `SQLSTATE[42S22]: Column not found: 1054 Unknown column 'u7_.level' in 'order clause'` .. seems legit.. Here is my thread on Stackoverflow with the complete explanation: https://stackoverflow.com/questions/48684549/dql-query-doctrine-places-joined-element-orderby-clause-in-another-elements-jun Every juncture is attached to the same main entity.
Author
Owner

@Cedoriku commented on GitHub (Feb 13, 2018):

OK I reordered the junctures in the query builder and it seems to work.. kind of tricky thought

@Cedoriku commented on GitHub (Feb 13, 2018): OK I reordered the junctures in the query builder and it seems to work.. kind of tricky thought
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5880