Tharos / LeanQuery

www.leanmapper.com
MIT License
6 stars 5 forks source link

Applying filters on joined associations #3

Open vojtech-dobes opened 10 years ago

vojtech-dobes commented 10 years ago

Currently when I join association with filter, filter isn't applied. I created small hack locally to make it work, but my solution doesn't support any extra arguments. I also introduced BC - callback now receives $table variable as first argument, which should be used in calls on Fluent to actually bind those calls to related table (which is aliased in DomainQuery).

If I can help in any way, let me know.

Tharos commented 10 years ago

I know about this. In my opinion we could sacrifice filters defined by m:filter flag since you can usually do the job via query API. But we should solve issue with implicit filters.

Another problem is that SQL queries generated by Lean Query are not usually compatible with common filters that do not aliases tables and fields.

I have an solution in my mind and I'd like to thing about it during my holiday next week. I'll open pull request for discussion when I'm back home. :)

vojtech-dobes commented 10 years ago

Well I am curious :). I would be happy if m:filter filters were supported as well, so I wouldn't have to duplicate my logic in 2 places (filter callback and domain query building). The only problem I encountered was the aliasing (and therefore necessity to tell filter name of table), I believe passing of all necessary arguments could be resolved.