dev/core#1744 - ActionSchedule - Simplify event naming
authorTim Otten <totten@civicrm.org>
Wed, 6 May 2020 02:17:03 +0000 (19:17 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 6 May 2020 03:06:56 +0000 (20:06 -0700)
CRM/Core/BAO/ActionSchedule.php
Civi/ActionSchedule/Event/MailingQueryEvent.php
Civi/ActionSchedule/Event/MappingRegisterEvent.php
Civi/ActionSchedule/Events.php
Civi/Core/Container.php
Civi/Token/AbstractTokenSubscriber.php

index 6a1472390d543663d10d47a8bc092d290e156bc0..c1d7ec1a104270d55cf61ca6ab974523641da72c 100644 (file)
@@ -36,7 +36,7 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule {
 
     if ($_action_mapping === NULL) {
       $event = \Civi::dispatcher()
-        ->dispatch(\Civi\ActionSchedule\Events::MAPPINGS,
+        ->dispatch('civi.actionSchedule.getMappings',
           new \Civi\ActionSchedule\Event\MappingRegisterEvent());
       $_action_mapping = $event->getMappings();
     }
@@ -516,7 +516,7 @@ FROM civicrm_action_schedule cas
 
     \Civi::dispatcher()
       ->dispatch(
-        \Civi\ActionSchedule\Events::MAILING_QUERY,
+        'civi.actionSchedule.prepareMailingQuery',
         new \Civi\ActionSchedule\Event\MailingQueryEvent($actionSchedule, $mapping, $select)
       );
 
index e8b136e84dc41506a8aaa5961664af2785573402..0158b41e7d43b2440d4f824b3104d010576aca9b 100644 (file)
@@ -37,6 +37,8 @@ use Symfony\Component\EventDispatcher\Event;
  *
  * (Note: When adding more JOINs, it seems typical to use !casMailingJoinType, although
  * some hard-code a LEFT JOIN. Don't have an explanation for why.)
+ *
+ * Event name: 'civi.actionSchedule.prepareMailingQuery'
  */
 class MailingQueryEvent extends Event {
 
index d3a29c3c5a282562a76adcd3aa0c9df2dae3389d..ef8c7f3750366f0e973011c62c8b4e402d6cb318 100644 (file)
@@ -9,6 +9,8 @@ use Symfony\Component\EventDispatcher\Event;
  * @package Civi\ActionSchedule\Event
  *
  * Register any available mappings.
+ *
+ * Event name: 'civi.actionSchedule.getMappings'
  */
 class MappingRegisterEvent extends Event {
 
index 3ff1a385e13201a81a9f02806812b573221c5d6f..7c74d56c1477a0e4dfd58e93f81e873a7f0cc37e 100644 (file)
@@ -4,15 +4,14 @@ namespace Civi\ActionSchedule;
 class Events {
 
   /**
-   * Register any available mappings.
-   *
-   * @see EntityListEvent
+   * @see \Civi\ActionSchedule\Event\MappingRegisterEvent
+   * @deprecated - You may simply use the event name directly. dev/core#1744
    */
   const MAPPINGS = 'civi.actionSchedule.getMappings';
 
   /**
-   * Prepare the pre-mailing query. This query loads details about
-   * the contact/entity so that they're available for mail-merge.
+   * @see \Civi\ActionSchedule\Event\MailingQueryEvent
+   * @deprecated - You may simply use the event name directly. dev/core#1744
    */
   const MAILING_QUERY = 'civi.actionSchedule.prepareMailingQuery';
 
index 7493eff1785db026b59b6f4982f320bdf85df49f..da029cfa4e259a7cf7a7e65b1294f985732c11c8 100644 (file)
@@ -362,12 +362,12 @@ class Container {
       'CRM_Core_LegacyErrorHandler',
       'handleException',
     ], -200);
-    $dispatcher->addListener(\Civi\ActionSchedule\Events::MAPPINGS, ['CRM_Activity_ActionMapping', 'onRegisterActionMappings']);
-    $dispatcher->addListener(\Civi\ActionSchedule\Events::MAPPINGS, ['CRM_Contact_ActionMapping', 'onRegisterActionMappings']);
-    $dispatcher->addListener(\Civi\ActionSchedule\Events::MAPPINGS, ['CRM_Contribute_ActionMapping_ByPage', 'onRegisterActionMappings']);
-    $dispatcher->addListener(\Civi\ActionSchedule\Events::MAPPINGS, ['CRM_Contribute_ActionMapping_ByType', 'onRegisterActionMappings']);
-    $dispatcher->addListener(\Civi\ActionSchedule\Events::MAPPINGS, ['CRM_Event_ActionMapping', 'onRegisterActionMappings']);
-    $dispatcher->addListener(\Civi\ActionSchedule\Events::MAPPINGS, ['CRM_Member_ActionMapping', 'onRegisterActionMappings']);
+    $dispatcher->addListener('civi.actionSchedule.getMappings', ['CRM_Activity_ActionMapping', 'onRegisterActionMappings']);
+    $dispatcher->addListener('civi.actionSchedule.getMappings', ['CRM_Contact_ActionMapping', 'onRegisterActionMappings']);
+    $dispatcher->addListener('civi.actionSchedule.getMappings', ['CRM_Contribute_ActionMapping_ByPage', 'onRegisterActionMappings']);
+    $dispatcher->addListener('civi.actionSchedule.getMappings', ['CRM_Contribute_ActionMapping_ByType', 'onRegisterActionMappings']);
+    $dispatcher->addListener('civi.actionSchedule.getMappings', ['CRM_Event_ActionMapping', 'onRegisterActionMappings']);
+    $dispatcher->addListener('civi.actionSchedule.getMappings', ['CRM_Member_ActionMapping', 'onRegisterActionMappings']);
 
     return $dispatcher;
   }
index 4f167828763e390d4ecc21e478362f01d613f66f..024f855b3eeb68fc661557ad17a2e20578134eee 100644 (file)
@@ -43,7 +43,7 @@ abstract class AbstractTokenSubscriber implements EventSubscriberInterface {
     return [
       'civi.token.list' => 'registerTokens',
       'civi.token.eval' => 'evaluateTokens',
-      \Civi\ActionSchedule\Events::MAILING_QUERY => 'alterActionScheduleQuery',
+      'civi.actionSchedule.prepareMailingQuery' => 'alterActionScheduleQuery',
     ];
   }