-
-
Notifications
You must be signed in to change notification settings - Fork 327
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
[Autocomplete] Fix Incompatibility filter_query and max_results (doc) #2440
Conversation
It looks like you unchecked the "Allow edits from maintainer" box. That is fine, but please note that if you have multiple commits, you'll need to squash your commits into one before this can be merged. Or, you can check the "Allow edits from maintainers" box and the maintainer can squash for you. Cheers! Carsonbot |
@@ -250,7 +250,7 @@ to the options above, you can also pass: | |||
|
|||
``filter_query`` (default: ``null``) | |||
If you want to completely control the query made for the "search results", | |||
use this option. This is incompatible with ``searchable_fields``:: | |||
use this option. This is incompatible with ``searchable_fields`` and ``max_results``:: |
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.
Nice catch here!
Would you also update the BaseAutocompleteType code to make the same check than filter/searcheable_fields ?
ux/src/Autocomplete/src/Form/BaseEntityAutocompleteType.php
Lines 68 to 75 in eab7db5
$resolver->setAllowedTypes('filter_query', ['callable', 'null']); | |
$resolver->setNormalizer('searchable_fields', function (Options $options, ?array $searchableFields) { | |
if (null !== $searchableFields && null !== $options['filter_query']) { | |
throw new RuntimeException('Both the searchable_fields and filter_query options cannot be set.'); | |
} | |
return $searchableFields; | |
}); |
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.
Can be a problem because max_results has default to 10.
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.
Well let's forget then :) Thanks for the fix!
Thank you @ytilotti. |
Fix in the documentation the incompatibility between filter_query and max_results.