. */ namespace vierbergenlars\AuthserverExternalAccountBundle\DependencyInjection\CompilerPass; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; use vierbergenlars\AuthserverExternalAccountBundle\AuthserverExternalAccountBundle; class ExternalAccountProviderPass implements CompilerPassInterface { public function process(ContainerBuilder $container) { if(!$container->has("vierbergenlars.authserver_external_account.account_provider_manager")) return; $definition = $container->findDefinition('vierbergenlars.authserver_external_account.account_provider_manager'); $taggedServices = $container->findTaggedServiceIds(AuthserverExternalAccountBundle::EXTERNAL_ACCOUNT_PROVIDER_TAG); foreach($taggedServices as $id => $tags) { $definition->addMethodCall('addAccountProvider', [new Reference($id)]); } } }