Conversation
|
Functions in the ORDER BY clause are not cross-platform. This has already been rejected for this reason. As of 2.2, you can achieve the result using the SELECT u, HIDDEN IDENTITY(u.email) as email FROM Doctrine\Tests\Models\CMS\CmsUser u ORDER BY email |
|
Any way to automatically move expression in OrderBy into the select clause and use the alias in Order By? |
|
@beberlei we discussed it with @guilhermeblanco a while ago on IRC and we both agreed that this would make the code more complex and that it can already be achieved using HIDDEN in 2.2. Our conclusion was that the best solution would be to improve the doc to explain how to achieve it with the current code (but I'm not sure if he worked on the doc after that) |
|
Sorry, I did not attend the previous discussion, how many databases do not support this ? I suggest documenting this behavior in databases that do not support functions, instead of limit this feature in all databases. |
|
@FabioBatSilva Are you sure? JPA v2 points at page 106 this: If Hibernate supports it, it's not documented I think. Official docs doesn't point anything either. |
|
@FabioBatSilva @beberlei @stof @asm89 Ok, here is the deal. Here is your original proposal: Here is my suggestion: |
|
hello @guilhermeblanco, i'm fine with your suggestion :) But Hibernate and NHibernate allow functions and aggregate functions in the user documentation. NHibernate : http://nhforge.org/doc/nh/en/index.html#queryhql-ordering Hibernate Docs : |
|
Hi guys. Please take a look |
lib/Doctrine/ORM/Query/Parser.php
Outdated
There was a problem hiding this comment.
changing the indentation is wrong here
Hello
http://www.doctrine-project.org/jira/browse/DDC-775
This patch adds support for arithmetic expression, case expression and functions on DQL ORDER BY clause.
Please let me know if can I make something better :)
Thanks