Skip to content
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

CRM-20993 - API - Extention get - Fix filtering by ID #10794

Merged
merged 2 commits into from
Aug 3, 2017

Conversation

tschuettler
Copy link
Contributor


Overview

Restore filtering by ID for API Extension get

Before

crm-20993-before

After

crm-20993-after

@colemanw
Copy link
Member

colemanw commented Jul 31, 2017

Correct me if I'm wrong, but extensions don't actually have an "id" do they? So what you're calling "id" here is just an array index and not guaranteed to remain consistent from one api call to the next.
If that's the case then I think "get by id" is false advertising.

@tschuettler
Copy link
Contributor Author

Yes, that seems kinda true currently. We actually do have an "id" as the PK in the database table for the installed extensions. The label of the parameter is somewhat misleading.
My intention was mainly to restore the functionality from before #9141 where it was possible to filter by id, but i don't really have a use case for this. Back then it was also only filtering by the sequentially generated id from the api call.

Should we just unset all those fields without any meaningfull functionality?

I could implement something to actually filter by extention_id but this may get pretty confusing with the sequential id.

@colemanw
Copy link
Member

colemanw commented Aug 1, 2017

I'd vote for dropping the fake array index id in favor of the actual id in the database.

@totten
Copy link
Member

totten commented Aug 1, 2017

Some extensions don't have records in the database, so they don't have DB ids.

From the perspective of CRM_Extension_Manager, the three most common statuses are:

  • uninstalled ==> the code exists, but there is no record in civicrm_extension
  • installed ==> the code exists, and there is a record in civicrm_extension, and it has is_active==1
  • disabled ==> the code exists, and there is a record in civicrm_extension, and it has is_active==0

If the API id worked exactly like the DB id, then you'd lose the ability to browse/see the uninstalled extensions.

@tschuettler
Copy link
Contributor Author

Yes, it seems sensible to keep the current artificial id. Having the uninstalled extension have empty ids would be pretty odd.

@seamuslee001
Copy link
Contributor

@tschuettler can you please run git rebase -i /master on your branch and see if you can squish the fix indentation commit into one of the other two?

@seamuslee001
Copy link
Contributor

you will need to do a git push CRM-20993 -f after the rebase has cleanly finished

----------------------------------------
* CRM-20993: API - Extension get - Cannot filter by ID anymore
  https://issues.civicrm.org/jira/browse/CRM-20993
@tschuettler
Copy link
Contributor Author

@seamuslee001 I gave it a try ...

@seamuslee001
Copy link
Contributor

Looks good @tschuettler I'm +1 on the PR as is, the false Id is better for the reasons Tim gives

@colemanw colemanw merged commit e167b65 into civicrm:master Aug 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants