Problem/Motivation

The dispatcher service in Symfony is named "event_dispatcher". For better interoperability, using the same name in Drupal would help a lot.

Proposed resolution

The patch renames the service from "dispatcher" to "event_dispatcher" everywhere it is used.

I've also removed this code:

    // Register configuration object factory.
    $container->register('config.subscriber.globalconf', 'Drupal\Core\EventSubscriber\ConfigGlobalOverrideSubscriber');
    $container->register('dispatcher', 'Symfony\Component\EventDispatcher\EventDispatcher')
      ->addMethodCall('addSubscriber', array(new Reference('config.subscriber.globalconf')));

as it is done elsewhere in the same file:

    $container->register('config_global_override_subscriber', 'Drupal\Core\EventSubscriber\ConfigGlobalOverrideSubscriber')
      ->addTag('event_subscriber');
CommentFileSizeAuthor
#5 event_dispatcher_5.patch6.19 KBfabpot
event_dispatcher.patch5.51 KBfabpot
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, event_dispatcher.patch, failed testing.

fabpot’s picture

Status: Needs work » Needs review

event_dispatcher.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, event_dispatcher.patch, failed testing.

aspilicious’s picture

+++ b/core/lib/Drupal/Core/CoreBundle.phpundefined
@@ -49,13 +49,9 @@ public function build(ContainerBuilder $container) {
-    // Register configuration object factory.
-    $container->register('config.subscriber.globalconf', 'Drupal\Core\EventSubscriber\ConfigGlobalOverrideSubscriber');
-    $container->register('dispatcher', 'Symfony\Component\EventDispatcher\EventDispatcher')

Why are you removing this?

Hmm? We are registring the same service "dispatcher" twice?
Seems like a mistake.

Besides of that you forgot to rename 'dispatcher' in core/modules/rdf/lib/.../RdfBundle

fabpot’s picture

Status: Needs work » Needs review
FileSize
6.19 KB

I've fixed the missing occurrence of the dispatcher service usage (I was working on an old version of the 8.x branch where the RdfBundle class did not exist).

Crell’s picture

Status: Needs review » Reviewed & tested by the community

Oh those tricky out of date branches...

chx’s picture

I see. fabpot's xmas present to us is working on Drupal 8. Thanks much :)

webchick’s picture

Category: feature » task
Status: Reviewed & tested by the community » Fixed

Cool! :D

Committed and pushed to 8.x. Thanks, fabpot! :)

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.