Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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');
Comment | File | Size | Author |
---|---|---|---|
#5 | event_dispatcher_5.patch | 6.19 KB | fabpot |
event_dispatcher.patch | 5.51 KB | fabpot | |
Comments
Comment #2
fabpot CreditAttribution: fabpot commentedevent_dispatcher.patch queued for re-testing.
Comment #4
aspilicious CreditAttribution: aspilicious commentedWhy 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
Comment #5
fabpot CreditAttribution: fabpot commentedI'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).Comment #6
Crell CreditAttribution: Crell commentedOh those tricky out of date branches...
Comment #7
chx CreditAttribution: chx commentedI see. fabpot's xmas present to us is working on Drupal 8. Thanks much :)
Comment #8
webchickCool! :D
Committed and pushed to 8.x. Thanks, fabpot! :)