Skip to content

Commit

Permalink
Fix deprecation notices for single colon routes definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihail Chervontsev committed Feb 9, 2023
1 parent 7ef5572 commit 2a68e28
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension;
use Symfony\Component\HttpKernel\Kernel;

final class LamodaMetricExtension extends ConfigurableExtension
{
Expand Down Expand Up @@ -79,6 +80,10 @@ private function processSources(ContainerBuilder $container, array $sources): vo
private function processResponders(ContainerBuilder $container, array $config): void
{
$routerLoader = $container->getDefinition('lamoda_metrics.route_loader');
$separator = ':';
if (Kernel::VERSION_ID >= 40100) {
$separator = '::';
}

foreach ($config as $name => $responderConfig) {
if (!$responderConfig['enabled']) {
Expand All @@ -102,7 +107,8 @@ private function processResponders(ContainerBuilder $container, array $config):
$controller->setArguments([$psrController]);

$path = $responderConfig['path'] ?? '/' . $name;
$routerLoader->addMethodCall('registerController', [$name, $path, $controllerId . ':createResponse']);

$routerLoader->addMethodCall('registerController', [$name, $path, $controllerId . $separator . 'createResponse']);
}
}
}

0 comments on commit 2a68e28

Please sign in to comment.