Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.16
    • Fix Version/s: 4.7.17
    • Component/s: Core CiviCRM
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      Developer Doc
    • Funding Source:
      Core Team Funds
    • Verified?:
      No

      Description

      Civi has used Symfony EventDispatcher for internal event-routing since ~4.5. With CRM-19813 and https://github.com/civicrm/org.civicrm.flexmailer making this more visible, inconsistencies in it will become more apparent.

      For example, 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.flexmailer.compose
      civi.flexmailer.run
      civi.flexmailer.send
      civi.flexmailer.walk
      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
      }}

      I've grepped the universe of published extensions and can't find any which rely on these events, so it seems we still have an opportunity to cleanup the names. I'd like to reduce the number of conventions down to two:

      1. For public hooks, use the hook_civicrm_fooBar. This matches the naming used by extensions and CMS modules, and it matches some of the current internal events.

      2. For primarily internal events, use dotted convention with camelCase. This seems consistent with most of the current event-names. The main question is whether to use a prefix (like "civi.token.") or not (like "actionSchedule."). Both are common among current events. IMHO, it's a good hedge our bets and use the prefix (in case some future integration winds up blending our EventDispatcher with someone else's EventDispatcher).

        Attachments

          Activity

            People

            • Assignee:
              timotten Tim Otten
              Reporter:
              timotten Tim Otten
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: