-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug api entities order #5402
Bug api entities order #5402
Conversation
SQL validated for adding ORDER but API returns entities not ordered by specified key. Not sure why |
Having same issue as @dreiser the order is not being applied |
I don't know guys, it works for me whatever column or direction I use. @dreiser can you help me debug this since I cannot replicate the problem? We tried a little debug in a private chat. So you tried to get the SQL query with |
Works for me as well. @dreiser @javjim-mautic Are you guys able to get the CURL request out of postman or whatever app you're using to test so we can see what the request looks like? |
It was a really lame postman error on my side. viewing on Pretty option it ordered by the ID, after some help from @alanhartless we figured it out when looking it as raw data.... Working properly @escopecz thanks!!! |
Description:
Mautic API Library has a QueryBuilder which generates order queries as array like this:
This array will be URL encoded and sen as a GET query param. The problem is that Mautic didn't have handling of such ordering definition implemented for getEntities methods.
This PR also fix a small issue where the
validateOrderByClause
removed dots from the column names. Soe.dateModified
would be changed toedateModified
and then thebuildOrderByClauseFromArray
would add it again because it's missing the dot and so the column name would becomee.edateModified
instead ofe.dateModified
. I don't know if this caused some real world bug, but it was causing new unit tests to fail.Steps to reproduce the bug:
order[0][col]=dateModified&order[0][dir]=DESC
You should get a list of segments with random order.
Steps to test this PR: