CRM-21792 Extension.get API - Fix regression (4.7.13) in result filtering #11709
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
When one calls the
Extension.get
API, it should support filtering. Forexample, these commands would return only installed extensions or only
uninstalled extensions (respectively):
Before
The implementation of
Extension.get
passes a list of all extensions down to_civicrm_api3_basic_array_get()
which is supposed to interpret any APIv3options (such as filter-values/offsets/limits). However, it confuses the
return
list (i.e. the names of any columns that the user wants to see) with thefilterable list (i.e. the names of any columns for which filtering is
permitted).
After
The implementation of
Extension.get
passes a list of all extensions down to_civicrm_api3_basic_array_get()
. It also passes a fixed list of columnswhich one might reasonably want to filter.
It might be nice to support filtering on all fields, but (a) several fields
wouldn't be sensible (because they're nested arrays) and (b) this provides a
smaller surface-area to maintain.
Comments
The doc-block for
_civicrm_api3_basic_array_get()
describes the purpose of this field:https://github.com/civicrm/civicrm-core/blob/4.7.0/api/v3/utils.php#L2390-L2391
Since ~v4.7.13, this line of code appears to have gone through several revisions, e.g.
CC @lucianov88 @twomice @tschuettler @seamuslee001 for review