-
Notifications
You must be signed in to change notification settings - Fork 31
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
Add coalesce filtering #179
Conversation
@bakura10 it's very near to what I was suggesting as well. I'd suggest using a key that is not a valid property name (such as Additionally, why not extending it to all searchable fields? |
How do you define a searchable field? The issue is that some people could try to filter by arbitrary key and making your database suffer if field is not indexed. By only restricting to "ids" (which is what you want often), it ensures filtering is done on an indexed fields. Regarding filtering arbitrary fields, we already have this through the Paginator plugin: https://github.com/zf-fr/zfr-rest/blob/master/src/ZfrRest/Mvc/Controller/Plugin/PaginatorWrapper.php#L68 But at least, you have full control over which fields make searchable. |
Good point. I think restricting by ID is fine for now then, but we may need to open an issue to support the other cases as well ("searchable" property in mappings?) |
Yep, the searchable mapping is a very nice idea. Anyway, tests and docs were added. Ready for final review! |
@bakura10 can you simply add the |
/** | ||
* The coalesce filtering key | ||
*/ | ||
// 'coalesce_filtering_key' => 'ids', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$ids
plox
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't this strange?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point is having something that EXPLICITLY cannot be an entity field: the regex for valid property names is something like /([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]+)/
: the default value provided by zfr-rest
should not match against this regex.
@Ocramius that was the idea