mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 22:10:45 +02:00
[ticket/11152] Change phpbb_di_pass_cron to generic phpbb_di_pass_collection
PHPBB3-11152
This commit is contained in:
@@ -18,8 +18,17 @@ if (!defined('IN_PHPBB'))
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
|
||||
class phpbb_di_pass_cron implements CompilerPassInterface
|
||||
class phpbb_di_pass_collection implements CompilerPassInterface
|
||||
{
|
||||
private $collection_service;
|
||||
private $service_tag;
|
||||
|
||||
public function __construct($collection_service, $service_tag)
|
||||
{
|
||||
$this->collection_service = $collection_service;
|
||||
$this->service_tag = $service_tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify the container before it is passed to the rest of the code
|
||||
*
|
||||
@@ -28,9 +37,9 @@ class phpbb_di_pass_cron implements CompilerPassInterface
|
||||
*/
|
||||
public function process(ContainerBuilder $container)
|
||||
{
|
||||
$definition = $container->getDefinition('cron.task_collection');
|
||||
$definition = $container->getDefinition($this->collection_service);
|
||||
|
||||
foreach ($container->findTaggedServiceIds('cron.task') as $id => $data)
|
||||
foreach ($container->findTaggedServiceIds($this->service_tag) as $id => $data)
|
||||
{
|
||||
$definition->addMethodCall('add', array($id));
|
||||
}
|
Reference in New Issue
Block a user