Skip to content

Commit 66cac05

Browse files
norkunasNyholm
authored andcommitted
Add autowiring bindings by Provider interface + providerName (#229)
1 parent e093a79 commit 66cac05

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

DependencyInjection/BazingaGeocoderExtension.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,15 @@
2323
use Geocoder\Plugin\Plugin\LocalePlugin;
2424
use Geocoder\Plugin\Plugin\LoggerPlugin;
2525
use Geocoder\Plugin\PluginProvider;
26+
use Geocoder\Provider\Provider;
2627
use Symfony\Component\Config\Definition\Processor;
2728
use Symfony\Component\Config\FileLocator;
2829
use Symfony\Component\DependencyInjection\ContainerBuilder;
2930
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
3031
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
3132
use Symfony\Component\DependencyInjection\Reference;
3233
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
34+
use Symfony\Component\HttpKernel\Kernel;
3335

3436
/**
3537
* William Durand <[email protected]>.
@@ -90,6 +92,10 @@ private function loadProviders(ContainerBuilder $container, array $config)
9092
foreach ($providerConfig['aliases'] as $alias) {
9193
$container->setAlias($alias, $serviceId);
9294
}
95+
96+
if (Kernel::VERSION_ID > 40200) {
97+
$container->registerAliasForArgument($serviceId, Provider::class, "{$providerName}Geocoder");
98+
}
9399
}
94100
}
95101

0 commit comments

Comments
 (0)