symfony 6 compatiblity
authordemeritcowboy <demeritcowboy@hotmail.com>
Sun, 14 Aug 2022 01:08:28 +0000 (21:08 -0400)
committerdemeritcowboy <demeritcowboy@hotmail.com>
Sun, 14 Aug 2022 23:41:26 +0000 (19:41 -0400)
Civi/Core/Container.php

index b33f950604c1608e01525fb0957ca1bf7d943aae..d0b70f120e5653f637b47cba55082a2c5116ff99 100644 (file)
@@ -90,7 +90,7 @@ class Container {
   public function createContainer() {
     $civicrm_base_path = dirname(dirname(__DIR__));
     $container = new ContainerBuilder();
-    $container->addCompilerPass(new RegisterListenersPass('dispatcher'));
+    $container->addCompilerPass(new RegisterListenersPass());
     $container->addObjectResource($this);
     $container->setParameter('civicrm_base_path', $civicrm_base_path);
     //$container->set(self::SELF, $this);
@@ -132,6 +132,9 @@ class Container {
       []
     ))
       ->setFactory([new Reference(self::SELF), 'createEventDispatcher'])->setPublic(TRUE);
+    // In symfony 6 it only accepts event_dispatcher as the id, but there are
+    // several places in civi and extensions that reference dispatcher.
+    $container->setAlias('event_dispatcher', 'dispatcher')->setPublic(TRUE);
 
     $container->setDefinition('magic_function_provider', new Definition(
       'Civi\API\Provider\MagicFunctionProvider',