Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 1, 2023. It is now read-only.

Commit f76291c

Browse files
committed
Proper management of the router resource type
Fixes #289 This is a workaround while waiting for symfony/symfony#11018
1 parent ff46000 commit f76291c

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

DependencyInjection/Compiler/RouterResourcePass.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,23 @@ public function process(ContainerBuilder $container)
3737
mkdir($dir, 0777, true);
3838
}
3939

40-
file_put_contents($file, Yaml::dump(array(
40+
$contents = array(
4141
'_assetic' => array('resource' => '.', 'type' => 'assetic'),
4242
'_app' => array('resource' => $container->getParameter('router.resource')),
43-
)));
43+
);
4444

45+
$router = $container->findDefinition('router.default');
46+
$routerConfigs = $router->getArgument(2);
47+
48+
if (isset($routerConfigs['resource_type'])) {
49+
$contents['_app']['type'] = $routerConfigs['resource_type'];
50+
}
51+
52+
$routerConfigs['resource_type'] = 'yaml';
53+
54+
$router->replaceArgument(2, $routerConfigs);
4555
$container->setParameter('router.resource', $file);
56+
57+
file_put_contents($file, Yaml::dump($contents));
4658
}
4759
}

0 commit comments

Comments
 (0)