Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REF] Consistently lookup dispatcher via Civi::dispatcher() #17154

Merged
merged 1 commit into from
Apr 23, 2020

Conversation

eileenmcnaughton
Copy link
Contributor

@eileenmcnaughton eileenmcnaughton commented Apr 23, 2020

Overview

Minor code standardisation

Before

We have are using 3 ways of getting the dispatcher

  1. Civi\Core\Container::singleton()->get('dispatcher')
  2. Civi::service('dispatcher')
  3. Civi::dispatcher()

Tim confirms there is no functional difference

After

All instances call Civi::dispatcher()

Technical Details

From @totten on chat

"they're the same thing

Civi::dispatcher() is just a little prettier

e.g. the IDE is smarter about completing with ::dispatcher()

historically, ::service(...) was around before ::dispatcher()

and ::service(...) is a more generic facility.
you don't want to add every random little object as new wrapper method in Civi.php, but dispatcher is a really common+central thing"

Comments

From #16983 but I needed to clarify this & so doing did it throughout

@civibot
Copy link

civibot bot commented Apr 23, 2020

(Standard links)

@civibot civibot bot added the master label Apr 23, 2020
We have 3 ways of iniatiging a dispatcher

Civi\Core\Container::singleton()->get('dispatcher')
Civi::service('dispatcher')
Civi::dispatcher()

Tim confirms there is no functional difference, so this consolidates on the shortest one :-)
@totten totten changed the title [REF] Make instantiation of dispatcher consistent. [REF] Consistently lookup dispatcher via Civi::dispatcher() Apr 23, 2020
@seamuslee001
Copy link
Contributor

Changes look fine to me merging

@seamuslee001 seamuslee001 merged commit cf40181 into civicrm:master Apr 23, 2020
@seamuslee001 seamuslee001 deleted the disp branch April 23, 2020 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants