-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
Fix readability & caching on CRM_Contact_BAO_Relationship::isInheritedMembershipInvalidated #15061
Conversation
(Standard links)
|
return [$relTypeId, $isDeletable]; | ||
$membershipType = CRM_Member_BAO_MembershipType::getMembershipType($membershipValues['membership_type_id']); | ||
$relTypeIds = $membershipType['relationship_type_id']; | ||
$membshipInheritedFrom = $membershipValues['owner_membership_id'] ?? NULL; |
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.
I just broke the IF into 2 because it was hard to read & a later fix would be more nuanced on the second part
Refactoring relates to #14410 |
…relationship This pulls out some of the good work & test written in civicrm#14410, but treating the parts as separate bugs with separate cleanup requirements. I put up cleanup in civicrm#15061 And this addresses the need for the relationship to not be deleted if a valid one still exists - wrangled out into a separate function
…relationship This pulls out some of the good work & test written in civicrm#14410, but treating the parts as separate bugs with separate cleanup requirements. I put up cleanup in civicrm#15061 And this addresses the need for the relationship to not be deleted if a valid one still exists - wrangled out into a separate function
e6d1976
to
bd9dab5
Compare
…relationship This pulls out some of the good work & test written in civicrm#14410, but treating the parts as separate bugs with separate cleanup requirements. I put up cleanup in civicrm#15061 And this addresses the need for the relationship to not be deleted if a valid one still exists - wrangled out into a separate function
@seamuslee001 this failed on something to do with the cache - possibly I need to add a clear. Before I dig - do you agree with adding this cache? |
I think that makes sense |
7356f2c
to
f8c1556
Compare
@seamuslee001 looks like it was the 'clear' thing - passing now |
…dMembershipInvalidated This removes an sql query & some hard wrangling & uses the api - wrapped in a caching helper.
f8c1556
to
eb151aa
Compare
Actually I just pushed a tweak so they are re-running |
…relationship This pulls out some of the good work & test written in civicrm#14410, but treating the parts as separate bugs with separate cleanup requirements. I put up cleanup in civicrm#15061 And this addresses the need for the relationship to not be deleted if a valid one still exists - wrangled out into a separate function
@seamuslee001 this is passing now |
I think the code looks fine to me and i think we should have enough test coverage in this are. Merging |
…relationship This pulls out some of the good work & test written in civicrm#14410, but treating the parts as separate bugs with separate cleanup requirements. I put up cleanup in civicrm#15061 And this addresses the need for the relationship to not be deleted if a valid one still exists - wrangled out into a separate function
…relationship This pulls out some of the good work & test written in civicrm#14410, but treating the parts as separate bugs with separate cleanup requirements. I put up cleanup in civicrm#15061 And this addresses the need for the relationship to not be deleted if a valid one still exists - wrangled out into a separate function
…relationship This pulls out some of the good work & test written in civicrm#14410, but treating the parts as separate bugs with separate cleanup requirements. I put up cleanup in civicrm#15061 And this addresses the need for the relationship to not be deleted if a valid one still exists - wrangled out into a separate function
…relationship This pulls out some of the good work & test written in civicrm#14410, but treating the parts as separate bugs with separate cleanup requirements. I put up cleanup in civicrm#15061 And this addresses the need for the relationship to not be deleted if a valid one still exists - wrangled out into a separate function
…relationship This pulls out some of the good work & test written in civicrm#14410, but treating the parts as separate bugs with separate cleanup requirements. I put up cleanup in civicrm#15061 And this addresses the need for the relationship to not be deleted if a valid one still exists - wrangled out into a separate function
…relationship This pulls out some of the good work & test written in civicrm#14410, but treating the parts as separate bugs with separate cleanup requirements. I put up cleanup in civicrm#15061 And this addresses the need for the relationship to not be deleted if a valid one still exists - wrangled out into a separate function
Overview
Mostly code readability but also improves caching
Before
Sql query & some hard-to-read & unnecessary wrangling
After
More readable. Introduction of a cached function improves performance
Technical Details
@seamuslee001 looking at this I was going to use the 'fields' cache but of course the name was wrong so I figured adding a generic 'metadata' cache would cover a lot of uses (including probably what 'fields' currently is....
Comments