mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Embeddables do not properly alias for order-by statements in query builder #5210
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 @jackdpeterson on GitHub (Aug 5, 2016).
If one has an entity that contains an embeddable (referenced as $priceObj):
And one attempts to perform an orderBy on the amount field. Doctrine generates a proper-looking DQL statement; however, the SQL statement where the order-by'd element is using the pre-aliased select statement. This appears to cause a 'semantical error'.
PHP:
Generated DQL:
Generated SQL:
$ php composer.phar show --installed | grep doctrine
@jackdpeterson commented on GitHub (Aug 5, 2016):
Expected:
Actual:
The key difference is that "b0.priceObj_amount" should become "priceObj_amount_10" according to the "OriginalFieldName" As "Re-mappedName"
@Ocramius commented on GitHub (Aug 5, 2016):
As mentioned on IRC, might be worth looking into
31a0c02b06/lib/Doctrine/ORM/Query/SqlWalker.php (L330)and code around it, which is responsible for alias generation.@jackdpeterson commented on GitHub (Aug 5, 2016):
This seems to be a duplicate / slightly different version of the same issues described in #5622. After modifying my entity to not use a value object and just do simple sorting ... this issue (albeit outside of an embeddable) remains.
@jackdpeterson commented on GitHub (Aug 5, 2016):
I can confirm that setting
Does resolve this issue.