Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Route prefix is duplicating #25746

Copy link
Copy link
Closed
Closed
Copy link
@wodka

Description

@wodka
Issue body actions
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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.