[TYPO3-dev] Custom query: select alias with constraints
Darryl Meganoski
dmeganoski at gmail.com
Fri Jan 19 18:42:04 CET 2018
Thanks for the reply. I have actually joined the slack, I haven't used slack much so I'm not very familiar but this seems like a good opportunity to get acquainted.
This is actually a rather simple extension. I should have given more detail.
It only utilizes one table, a list of businesses with geo coordinates of each. I just need to be able to calculate the distance between a (user provided) set of coordinates and the record's coordinates. This is done with some native sql functions and assigned to an alias (distance).
I need to be able to sort by this distance, and I need to be able to access the value.
Perhaps I'm a bit spoiled coming from laravel, but with eloquent it would be done something like this
$model->selectRaw()->where()->orderBy()->get();
Unfortunately, $repository->createQuery() doesn't seem to have any functions for selecting or aliasing columns. (I am guessing selecting should be handled in tca) but I seem to be at a loss with the alias.
If you have any more to add it would be appreciated. :) I am going to also mention it in the slack, see if anyone else has input.
More information about the TYPO3-dev
mailing list