Adds some ordering options to PhamePost queries. Works on search, PhameHome, BlogHome
Details
- Reviewers
epriestley - Maniphest Tasks
- T9897: Unbeta Feedback on Phame
- Commits
- rPb94b16df4900: Allow Phame Posts to be ordered by datePublished
Try searching with Order By set to Date Published in application search, get correct order. Check a blog home page, check PhameHome.
Diff Detail
- Repository
- rP Phabricator
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
To get this working on PhameHome, it should be sufficient to add ->setOrder('published') to the PhamePostQuery, I think.
src/applications/phame/query/PhamePostQuery.php | ||
---|---|---|
126 | Hrrm, I'd expect this to break queries, although maybe MySQL is more lenient than I thought. For consistency, prefer a short alias like post. When providing a table alias, you should also use that alias to refer to columns elsewhere. In buildWhereClauseParts(), edit the queries to be post.id IN ... instead of id IN ..., etc. | |
131 | This key should be 'published', not 'name'. As written, you'd make an API call like phame.post.search(order = name) to order things by publish date. |
src/applications/phame/query/PhamePostQuery.php | ||
---|---|---|
126 | doesn't this need to be the name of the table? If I make it post, it fails. |
What's the error you get if you call it post?
(It's normally not the name of the table -- both because it's a little more convenient to use a shorter alias, and because sometimes you'll join the table to itself, which makes it ambiguous/weird if you use the table name.)
e.g., see ManiphestTaskQuery:
protected function getPrimaryTableAlias() { return 'task'; }
(No idea why that test is failing some of the time, let me see if I can figure that out.)
I tried to reproduce the issue locally and on the build server without any luck. I'll add some more assertions if it keeps happening to maybe narrow it down.