From f247addc55ecf9e35dbd1afd8c8da044bef7a3c3 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 7 Mar 2017 00:14:55 -0800 Subject: [PATCH] CRM-20224 - Civi\API\Events - Rename internal events (`api.foo` vs `civi.api.foo`) 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 `api.foo` convention. Based on grepping universe, I don't believe any extensions rely on the `DAO::*` events. --- Civi/API/Events.php | 10 +++++----- Civi/API/Subscriber/WrapperAdapter.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Civi/API/Events.php b/Civi/API/Events.php index c6abcb011f..1dd7349278 100644 --- a/Civi/API/Events.php +++ b/Civi/API/Events.php @@ -45,7 +45,7 @@ class Events { * * @see AuthorizeEvent */ - const AUTHORIZE = 'api.authorize'; + const AUTHORIZE = 'civi.api.authorize'; /** * Determine which API provider executes the given request. For successful @@ -54,28 +54,28 @@ class Events { * * @see ResolveEvent */ - const RESOLVE = 'api.resolve'; + const RESOLVE = 'civi.api.resolve'; /** * Apply pre-execution logic * * @see PrepareEvent */ - const PREPARE = 'api.prepare'; + const PREPARE = 'civi.api.prepare'; /** * Apply post-execution logic * * @see RespondEvent */ - const RESPOND = 'api.respond'; + const RESPOND = 'civi.api.respond'; /** * Handle any exceptions. * * @see ExceptionEvent */ - const EXCEPTION = 'api.exception'; + const EXCEPTION = 'civi.api.exception'; /** * Weight - Early diff --git a/Civi/API/Subscriber/WrapperAdapter.php b/Civi/API/Subscriber/WrapperAdapter.php index 00274a932f..9340b3b720 100644 --- a/Civi/API/Subscriber/WrapperAdapter.php +++ b/Civi/API/Subscriber/WrapperAdapter.php @@ -33,7 +33,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * This is a wrapper for the legacy "API Wrapper" interface which allows * wrappers to run through the new kernel. It translates from dispatcher events - * ('api.prepare', 'api.respond') to wrapper calls ('fromApiInput', 'toApiOutput'). + * ('civi.api.prepare', 'civi.api.respond') to wrapper calls ('fromApiInput', 'toApiOutput'). */ class WrapperAdapter implements EventSubscriberInterface { -- 2.25.1