-
-
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
Move DAO function to DAO class, call it from Merge class #12340
Move DAO function to DAO class, call it from Merge class #12340
Conversation
(Standard links)
|
test this please |
e75af11
to
e3e87c7
Compare
* schema to derive this. | ||
*/ | ||
public static function getReferencesToContactTable() { | ||
if (isset(\Civi::$statics[__CLASS__]) && isset(\Civi::$statics[__CLASS__]['contact_references'])) { |
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.
@totten so I'm curious about converting this to a cache call
In theory the things that would change the list of tables here are
- a new custom table being created
- a change to core schema
- a change to hook-declared entity types.
3 breaks down into
a) new extension installed
b) new extension uninstalled
c) extension upgrade WITH upgrade extension script run
d) extension upgrade without any script run
e) main civicrm upgrade script runs and hooks are called in upgrade mode - causing the list of cached extension functions to be built without extension hooks being called and hence to be missing some
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.
(note I think this PR is mergeable regardless of my tangent)
@monishdeb @jitendrapurohit @seamuslee001 any of you up to review this - it's simpler than it looks - just moving code around |
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.
Manually tested the dedupe merge process and looks good to me. +1 fom me in merging this PR.
thanks @jitendrapurohit |
Overview
Moves a function to a more logical place, deprecates a specific old hook usage (hook merge in cidRefs context)
Before
Code works & test CRM_Dedupe_MergerTest::getCidRefs passes. Code is less logical
After
Code works & test CRM_Dedupe_MergerTest::getCidRefs passes. Code is more logical. Poorly thought out hook call is deprecated and that same hook is no longer called from an unrelated context.
Technical Details
This change is primarily moving most of the contents of cidRefs (which is well tested already) to CRM_Core_DAO::getReferencesToContactTable. In addition addCustomTablesExtendingContactsToCidRefs is moved to CRM_Core_DAO (since otherwise the 'self::' call doesn't work.
The CRM_Dedupe_Merger::cidRefs function is retained as, in addition to calling the new function,
it calls the hook
That hook is poorly thought out as the merge hook is called in different contexts with completely different expectations. In this context the entityTypes hook is preferred. After a number releases with it deprecated we can remove the whole function.
In the meantime the unrelated function CRM_Logging_Schema::getLogTablesForContact() no longer calls that hook
Comments