Skip to content

Commit

Permalink
Merge pull request #21 from nightlinus/fix/remove_deprecation_notices…
Browse files Browse the repository at this point in the history
…_for_sf_5

Fix deprecation notices for single colon routes definitions
  • Loading branch information
akurov-lam authored Jan 10, 2024
2 parents 7ef5572 + 2a68e28 commit 1fcf74d
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 1fcf74d

Please sign in to comment.