From 96e671ee8ffb0806d3bd5304bd27a37eafcda7c9 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 26 May 2021 00:40:22 -0700 Subject: [PATCH] (REF) RelationshipCache BAO - Switch to HookInterface This is just an example of doing declarative event-registration from a BAO. --- CRM/Contact/BAO/RelationshipCache.php | 4 ++-- Civi/Core/Container.php | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CRM/Contact/BAO/RelationshipCache.php b/CRM/Contact/BAO/RelationshipCache.php index c1483973e8..b7622dfc65 100644 --- a/CRM/Contact/BAO/RelationshipCache.php +++ b/CRM/Contact/BAO/RelationshipCache.php @@ -12,7 +12,7 @@ /** * Class CRM_Contact_BAO_RelationshipCache. */ -class CRM_Contact_BAO_RelationshipCache extends CRM_Contact_DAO_RelationshipCache { +class CRM_Contact_BAO_RelationshipCache extends CRM_Contact_DAO_RelationshipCache implements \Civi\Test\HookInterface { /** * The "mappings" array defines the values to put into `civicrm_relationship_cache` @@ -69,7 +69,7 @@ class CRM_Contact_BAO_RelationshipCache extends CRM_Contact_DAO_RelationshipCach * @param \Civi\Core\Event\GenericHookEvent $e * @see \CRM_Utils_Hook::triggerInfo */ - public static function onHookTriggerInfo($e) { + public static function on_hook_civicrm_triggerInfo($e) { $relUpdates = self::createInsertUpdateQueries(); // Use utf8mb4_bin or utf8_bin, depending on what's in use. $collation = preg_replace('/^(utf8(?:mb4)?)_.*$/', '$1_bin', CRM_Core_BAO_SchemaHandler::getInUseCollation()); diff --git a/Civi/Core/Container.php b/Civi/Core/Container.php index fa723a77b3..62f1879407 100644 --- a/Civi/Core/Container.php +++ b/Civi/Core/Container.php @@ -400,7 +400,6 @@ class Container { $dispatcher->addListener('hook_civicrm_permissionList', ['CRM_Core_Permission_List', 'findCiviPermissions'], 950); $dispatcher->addListener('hook_civicrm_permissionList', ['CRM_Core_Permission_List', 'findCmsPermissions'], 925); - $dispatcher->addListener('hook_civicrm_triggerInfo', ['\CRM_Contact_BAO_RelationshipCache', 'onHookTriggerInfo']); $dispatcher->addListener('civi.dao.postInsert', ['\CRM_Core_BAO_RecurringEntity', 'triggerInsert']); $dispatcher->addListener('civi.dao.postUpdate', ['\CRM_Core_BAO_RecurringEntity', 'triggerUpdate']); $dispatcher->addListener('civi.dao.postDelete', ['\CRM_Core_BAO_RecurringEntity', 'triggerDelete']); -- 2.25.1