1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +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:
Marc Alexander
2023-08-19 13:38:02 +02:00
parent 549c818a5c
commit 66b54d4469
32 changed files with 110 additions and 59 deletions

View 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);
}
}
}
}