From 9407546428fd44e96a457c67fe81b568e724911b Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Fri, 3 Mar 2017 14:43:27 -0800 Subject: [PATCH] CRM-20224 - CRM_Core_DAO - Rename internal events (`DAO::foo-bar` vs `civi.dao.fooBar`) If you look at the list of events emitted through the EventDispatcher, you'll find several different formats for the names: ``` actionSchedule.getMappings actionSchedule.prepareMailingQuery api.authorize api.exception api.prepare api.resolve api.respond civi.core.install civi.token.eval civi.token.list civi.token.render DAO::post-delete DAO::post-insert DAO::post-update hook_civicrm_caseChange hook_civicrm_post::Activity hook_civicrm_post::Case hook_civicrm_unhandled_exception ``` This patch renames events using the `DAO::foo-bar` convention. Based on grepping universe, I don't believe any extensions rely on the `DAO::*` events. --- CRM/Core/DAO.php | 6 +++--- Civi/Core/Container.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CRM/Core/DAO.php b/CRM/Core/DAO.php index 2c4d8992b7..351819f178 100644 --- a/CRM/Core/DAO.php +++ b/CRM/Core/DAO.php @@ -480,7 +480,7 @@ class CRM_Core_DAO extends DB_DataObject { if ($hook) { $event = new \Civi\Core\DAO\Event\PostUpdate($this); - \Civi::service('dispatcher')->dispatch("DAO::post-update", $event); + \Civi::service('dispatcher')->dispatch("civi.dao.postUpdate", $event); } } else { @@ -488,7 +488,7 @@ class CRM_Core_DAO extends DB_DataObject { if ($hook) { $event = new \Civi\Core\DAO\Event\PostUpdate($this); - \Civi::service('dispatcher')->dispatch("DAO::post-insert", $event); + \Civi::service('dispatcher')->dispatch("civi.dao.postInsert", $event); } } $this->free(); @@ -529,7 +529,7 @@ class CRM_Core_DAO extends DB_DataObject { $result = parent::delete($useWhere); $event = new \Civi\Core\DAO\Event\PostDelete($this, $result); - \Civi::service('dispatcher')->dispatch("DAO::post-delete", $event); + \Civi::service('dispatcher')->dispatch("civi.dao.postDelete", $event); $this->free(); return $result; diff --git a/Civi/Core/Container.php b/Civi/Core/Container.php index 76076375a6..d95b62aac1 100644 --- a/Civi/Core/Container.php +++ b/Civi/Core/Container.php @@ -245,9 +245,9 @@ class Container { $dispatcher->addListener('hook_civicrm_post::Case', array('\Civi\CCase\Events', 'fireCaseChange')); $dispatcher->addListener('hook_civicrm_caseChange', array('\Civi\CCase\Events', 'delegateToXmlListeners')); $dispatcher->addListener('hook_civicrm_caseChange', array('\Civi\CCase\SequenceListener', 'onCaseChange_static')); - $dispatcher->addListener('DAO::post-insert', array('\CRM_Core_BAO_RecurringEntity', 'triggerInsert')); - $dispatcher->addListener('DAO::post-update', array('\CRM_Core_BAO_RecurringEntity', 'triggerUpdate')); - $dispatcher->addListener('DAO::post-delete', array('\CRM_Core_BAO_RecurringEntity', 'triggerDelete')); + $dispatcher->addListener('civi.dao.postInsert', array('\CRM_Core_BAO_RecurringEntity', 'triggerInsert')); + $dispatcher->addListener('civi.dao.postUpdate', array('\CRM_Core_BAO_RecurringEntity', 'triggerUpdate')); + $dispatcher->addListener('civi.dao.postDelete', array('\CRM_Core_BAO_RecurringEntity', 'triggerDelete')); $dispatcher->addListener('hook_civicrm_unhandled_exception', array( 'CRM_Core_LegacyErrorHandler', 'handleException', -- 2.25.1