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

Remove legacy apiquery call from isContactInGroup #24062

Merged
merged 1 commit into from
Aug 2, 2022

Conversation

eileenmcnaughton
Copy link
Contributor

Overview

Remove legacy apiquery call from isContactInGroup

Before

Legacy function call to determine if contact is in a group

After

Api call

Technical Details

This is only called from one place in core & one test. I figured I'd clean it up while the test still calls if for reviewer friendliness. So, it's only soft-deprecated at the main function level

Comments

Getting rid of calls to apiQuery is a back-burner goal

@civibot
Copy link

civibot bot commented Jul 27, 2022

(Standard links)

@civibot civibot bot added the master label Jul 27, 2022
return FALSE;
public static function isContactInGroup(int $contactID, int $groupID) {
return (bool) Contact::get(FALSE)
->addWhere('id', '=', $contactID)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
->addWhere('id', '=', $contactID)
->addWhere('id', '=', $contactID)
->selectRowCount()

Copy link
Member

@colemanw colemanw Jul 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton this PR looks good overall, but if all we're doing is counting then this results in more efficient SQL.

@eileenmcnaughton
Copy link
Contributor Author

@colemanw I've updated per your suggestion

@colemanw colemanw merged commit 539eb78 into civicrm:master Aug 2, 2022
@colemanw colemanw deleted the api_query branch August 2, 2022 14:47
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.

2 participants