-
-
Notifications
You must be signed in to change notification settings - Fork 158
Allow filtering on properties of HasMany relationships #238
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
Comments
This is really kicking my rump -- I'm trying to do this with a HasManyThrough relationship so the posted workaround doesn't apply. Any advice, by chance? |
@XaserAcheron is this still an issue? We can consider looking into it after releasing 3.2.0 |
It's still a bit troublesome -- I ended up having to do some non-ideal workarounds from the UI side in order to get around the limitation -- but I'm not critically blocked or anything, thankfully. :) Thanks for the help, BTW! |
That is, indeed, suboptimal. I think this issue is one of the more workable issues so we might still look into it after v3.2.0. Also, you are encouraged to get started on it (in which case you can PM me with any questions) |
@maurei this would be easily done in the new filtering/hooks backend. |
In that case you'd have to "hardcode" the filter in a hook, which doesnt allow for much flexibility like when filters are added dynamically with query params. Although might be possible to inject JsonApiContext in the hooks and access the url query params as such, that feels hacky. I think it should be supported off the shelve I'm wondering though how this relates to the infamous Filtered Include issue of EF Core (#1833). Im starting to think we're facing the same issue here |
I meant that we can parse the query filters and apply them on the needed items, as we are parsing them in memory anyway, refardless of hooks |
Workaround is introduced in v4: resource hooks |
Consider the following:
If you try to filter
It will result in an exception
We should consider an approach similar to EF Plus's IncludeFilter : http://entityframework-plus.net/query-include-filter
Workaround
The current workaround is to query the child resource directly and expose the parent id as an attribute on the resource:
The text was updated successfully, but these errors were encountered: