mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-30 21:40:43 +02:00
[ticket/17176] Use Symfony name for event dispatcher
The previously used override of the names is no longer supported. PHPBB3-17176
This commit is contained in:
@@ -205,11 +205,11 @@ class container_builder
|
||||
// Mark all services public
|
||||
$this->container->addCompilerPass(new pass\markpublic_pass());
|
||||
|
||||
// Event listeners "phpBB style"
|
||||
$this->container->addCompilerPass(new RegisterListenersPass('dispatcher', 'event.listener_listener', 'event.listener'));
|
||||
// Convert old event dispatcher syntax
|
||||
$this->container->addCompilerPass(new pass\convert_events());
|
||||
|
||||
// Event listeners "Symfony style"
|
||||
$this->container->addCompilerPass(new RegisterListenersPass('dispatcher'));
|
||||
// Event listeners
|
||||
$this->container->addCompilerPass(new RegisterListenersPass());
|
||||
|
||||
if ($this->use_extensions)
|
||||
{
|
||||
|
51
phpBB/phpbb/di/pass/convert_events.php
Normal file
51
phpBB/phpbb/di/pass/convert_events.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* This file is part of the phpBB Forum Software package.
|
||||
*
|
||||
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
||||
* @license GNU General Public License, version 2 (GPL-2.0)
|
||||
*
|
||||
* For full copyright and license information, please see
|
||||
* the docs/CREDITS.txt file.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace phpbb\di\pass;
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
|
||||
/**
|
||||
* Converts event types to Symfony ones
|
||||
*/
|
||||
class convert_events implements CompilerPassInterface
|
||||
{
|
||||
/** @var string[] Map for conversions of types */
|
||||
private static array $conversions = [
|
||||
'event.listener_listener' => 'kernel.event_listener',
|
||||
'event.listener' => 'kernel.event_subscriber',
|
||||
];
|
||||
|
||||
/**
|
||||
* Modify the container before it is passed to the rest of the code
|
||||
* Add Symfony event tags to previously used phpBB ones
|
||||
*
|
||||
* @param ContainerBuilder $container ContainerBuilder object
|
||||
* @return void
|
||||
*/
|
||||
public function process(ContainerBuilder $container): void
|
||||
{
|
||||
// Add alias for event dispatcher
|
||||
$container->addAliases(['dispatcher' => 'event_dispatcher']);
|
||||
|
||||
foreach (self::$conversions as $from => $to)
|
||||
{
|
||||
foreach ($container->findTaggedServiceIds($from, true) as $id => $tags)
|
||||
{
|
||||
$definition = $container->getDefinition($id);
|
||||
$definition->addTag($to);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user