diff --git a/core/core.services.yml b/core/core.services.yml index b4237cb..1fc2751 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -330,7 +330,7 @@ services: class: Drupal\Core\Routing\CurrentRouteMatch arguments: ['@request_stack'] event_dispatcher: - class: Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher + class: Drupal\Core\EventDispatcher\ContainerAwareEventDispatcher arguments: ['@service_container'] controller_resolver: class: Drupal\Core\Controller\ControllerResolver diff --git a/core/lib/Drupal/Core/EventDispatcher/ContainerAwareEventDispatcher.php b/core/lib/Drupal/Core/EventDispatcher/ContainerAwareEventDispatcher.php index 05fd7bd..42e7c6d 100644 --- a/core/lib/Drupal/Core/EventDispatcher/ContainerAwareEventDispatcher.php +++ b/core/lib/Drupal/Core/EventDispatcher/ContainerAwareEventDispatcher.php @@ -7,7 +7,15 @@ namespace Drupal\Core\EventDispatcher; -class ContainerAwareEventDispatcher { +use Drupal\Core\DependencyInjection\DependencySerializationTrait; +use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher as BaseContainerAwareEventDispatcher; + +/** + * Extends the base event dispatcher to be serializable. + */ +class ContainerAwareEventDispatcher extends BaseContainerAwareEventDispatcher { + + use DependencySerializationTrait; } diff --git a/core/modules/block/tests/src/BlockManagerTest.php b/core/modules/block/tests/src/BlockManagerTest.php index fc59eed..60344c9 100644 --- a/core/modules/block/tests/src/BlockManagerTest.php +++ b/core/modules/block/tests/src/BlockManagerTest.php @@ -39,7 +39,7 @@ public function testBlockPluginEvents() { ->method('clearCachedDefinitions'); $event_dispatcher->addSubscriber($block_manager); - $event = new PluginRemovalEvent('test_plugin_id'); + $event = new PluginRemovalEvent('plugin_block', 'test_plugin_id'); $event_dispatcher->dispatch(PluginRemovalEvents::PERMANENTLY_UNAVAILABLE, $event); }