mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Allow field aliases in subselects #4922
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kitsunet on GitHub (Dec 8, 2015).
In a DQL Subselect you cannot give the selected field an alias to reference to it because the Parser uses
SimpleSelectClause(fine as you want to only select one field) but that in turn usessimpleSelectExpressioninstead of justselectExpressionto parse the SELECT part of the subquery. Unfortunately doessimpleSelectExpressionnot properly take aliases into account.The following Query therefore becomes impossible:
SELECT n FROM Nodes WHERE n.id IN (SELECT SUBSTRING(d.idAndStuff, 4, 36) AS node_id FROM Dim WHERE node_id LIKE ....)because without the alias "node_id" I cannot reference this derived field.@kitsunet commented on GitHub (Dec 8, 2015):
A quick test with using
selectExpressioninstead ofsimpleSelectExpressionmakes that work, but I don't know if that has unintented side effects.