Skip to content

DashboardController default route with locale #6870

@Axel29

Description

@Axel29

Describe the bug

When using the new AdminDashboard PHP Attribute to set the default route with a locale set, after logging in, the locale is not set in the URL, giving a 404.

To Reproduce

  1. Create a DashboardController
  2. Add the following PHP Attribute #[AdminDashboard('/admin/{_locale}', 'admin')]
  3. Remove the var/cache folder's content and clear Symfony's cache using php bin/console cache:clear

Additional context
Setting the route at the index method level works:

    #[IsGranted('ROLE_ADMIN')]
    #[Route('/admin/{_locale}', name: 'admin')]
    public function index(string $_locale = 'fr'): Response
    {
        $adminUrlGenerator = $this->container->get(AdminUrlGenerator::class);

        return $this->redirect($adminUrlGenerator->setController(ShopifyOrderCrudController::class)->generateUrl());
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions