Closed
Description
Q | A |
---|---|
Bug report? | yes |
Feature request? | no |
BC Break report? | no |
RFC? | no |
Symfony version | 4.0.3 |
If loading multiple templates via glob with a prefix the prefix is beeing duplicated because RouteCollectionBuilder::build is called multiple times.
Example:
# config/routes/other/a.yaml
controller_a:
resource: ../../../src/Controller/AController
type: annotation
# config/routes/other/b.yaml
controller_b:
resource: ../../../src/Controller/BController
type: annotation
and then in the Kernel:
protected function configureRoutes(RouteCollectionBuilder $routes){
$confDir = $this->getProjectDir().'/config';
/* other routes removed */
$routes->import($confDir.'/routes/other/**/*'.self::CONFIG_EXTS, '/other/', 'glob');
}
will create the routes:
controller_a /other/other/a
controller_b /other/other/b
by doing this the duplication can be reproduced:
protected function configureRoutes(RouteCollectionBuilder $routes){
$confDir = $this->getProjectDir().'/config';
/* other routes removed */
$b = $routes->import($confDir.'/routes/other/**/*'.self::CONFIG_EXTS, '/other/', 'glob');
$b->build();
}
will create the routes:
controller_a /other/other/other/a
controller_b /other/other/other/b