-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
name_prefix will duplicate all my resource routes #29079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Are you sure that there isn't simply another config file that loads the routes without the prefix? Could you create a small example application that allows to reproduce? |
You probably have this config as well https://github.com/symfony/recipes/blob/5b3ce909504b9366405820c49bc9f0e13ac4be54/doctrine/annotations/1.0/config/routes/annotations.yaml#L1-L3 This adds the routes from all annotations. Then you also import them under a prefix, which creates the duplicate routes. So you need to exclude the controller from the auto discovery. |
Hello I had a similar issue with a fresh 4.1 install: # routes.yaml
billing:
name_prefix: billing_
prefix: /billing
resource: routes/billing.yaml
# billing.yaml
search:
path: /search
controller: App\Controller\BillingController::search
methods: [POST, OPTIONS]
I resolved the problem commenting some lines in Kernel.php protected function configureRoutes(RouteCollectionBuilder $routes)
{
$confDir = $this->getProjectDir().'/config';
// $routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
// $routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob');
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
} I have a question about the Thanks for helping |
You can just remove it from your project. |
I think it's a bug related with the feature #19612
I have a route group for an admin section, and I want to prefix the URL and name of each route inside the
App\Controller\Admin
namespace.If I go only for the route prefix it works without any problem
The router debug gives me the following output:
The problem comes when I add the
name_prefix
route:The router debug gives the following output, and I can verify that the URLs are duplicated:
Originally posted by @devnix in #19612 (comment)
The text was updated successfully, but these errors were encountered: