-
-
Notifications
You must be signed in to change notification settings - Fork 814
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
[REF] Reduce calls to CRM_Member_PseudoConstant::membershipType #17987
Conversation
(Standard links)
|
$membershipType = CRM_Member_PseudoConstant::membershipType($entityObj->membership_type_id); | ||
$subject = $membershipType ? $membershipType : ts('Membership'); | ||
|
||
if (is_array($subject)) { |
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.
We can see in the line above this is not an array....
$this->callAPISuccessGetSingle('Activity', [ | ||
'activity_type_id' => 'Membership Signup', | ||
'source_record_id' => $membershipID, | ||
'subject' => 'General - Payment - Status: test status', |
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.
This tests the altered lines
94dbf49
to
0067191
Compare
1
Outdated
@@ -0,0 +1,24 @@ | |||
Reduce calls to CRM_Member_PseudoConstant::membershipType |
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.
@eileenmcnaughton please remove this file
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.
dang
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.
gone by lunchtime (yours, not mine)
$subject = implode(", ", $subject); | ||
} | ||
$membershipType = CRM_Core_PseudoConstant::getLabel('CRM_Member_BAO_Membership', 'membership_type_id', $entityObj->membership_type_id); | ||
$subject = $membershipType ?: ts('Membership'); |
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.
should this not be ??
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.
This is the same as
if ($membershipType) {
$membershipType;
}
else {
ts('Membership')
}
Whereas ?? is
if (isset($membershipType)) {
$membershipType;
}
else {
ts('Membership')
}
This function defaults to not using the cached version so that's a pretty good argument for making a more active effort to deprecate it. The createMembership function flushes it so we don't need to do that so much in tests now either. I also included swapping status over in the test
0067191
to
a89e0a3
Compare
Jenkins re test this please |
Overview
Switches code to use recommended function which, bonus, is cached
Before
After
Technical Details
This function defaults to not using the cached version so that's a pretty good argument for making a more
active effort to deprecate it. The createMembership function flushes it so we don't need to do that
so much in tests now either. I also included swapping status over in the test
Comments