-
Notifications
You must be signed in to change notification settings - Fork 142
Open
Labels
Description
Is your feature request related to a problem? Please describe.
I'm trying to sort and filter by a field that's generated in selection, it's not on DB. But the system tries to put an alias which is not the case.
Describe the solution you'd like
It may be a good solution to define allowed sorting fields and filters and how those would work individually
Additional context
This is a custom selection I need to make
query.addSelect([
"COMPANY_IS_OPEN(`meta`.`value`) as isOpen",
"COMPANY_NEXT_OPEN_DATE(`meta`.`value`, NOW()) as nextOpen",
"COMPANY_NEXT_CLOSE_DATE(`meta`.`value`) as nextClose",
"COMPANY_ALLOW_BUY_CLOSED_BY_ID(`Company`.`id`) as allowBuyClosed",
]);
// order by (open | allowBuyClosed)
query.addOrderBy('isOpen OR (allowBuyClosed IS NOT NULL AND allowBuyClosed <> "false")', 'DESC');
I can't filter or sort by field isOpen or nextOpen