src_legacy/Tionvel/ImporterBundle/TionvelImporterBundle.php line 10

Open in your IDE?
  1. <?php
  2. namespace Tionvel\ImporterBundle;
  3. use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
  4. use Symfony\Component\DependencyInjection\ContainerBuilder;
  5. use Symfony\Component\DependencyInjection\Reference;
  6. use Symfony\Component\HttpKernel\Bundle\Bundle;
  7. class TionvelImporterBundle extends Bundle
  8. {
  9. public function build(ContainerBuilder $container)
  10. {
  11. parent::build($container);
  12. $container->addCompilerPass(new class implements CompilerPassInterface {
  13. public function process(ContainerBuilder $container)
  14. {
  15. $registry = $container->getDefinition('tionvel.importer_bundle.importer.importer_executor');
  16. foreach ($container->findTaggedServiceIds('tionvel_importer') as $id => $tags) {
  17. $registry->addMethodCall('addImporter', [$tags[0]['key'] ?? uniqid(), new Reference($id)]);
  18. }
  19. }
  20. });
  21. }
  22. }