[Routing] Default path for localized routes

This commit is contained in:
Javier Eguiluz
2026-01-22 15:48:34 +01:00
parent d5e9f415a5
commit cc251044b4

View File

@@ -2199,6 +2199,9 @@ avoids the need for duplicating routes, which also reduces the potential bugs:
#[Route(path: [
'en' => '/about-us',
'nl' => '/over-ons'
// optionally, you can define a path without a locale. It will be used
// for any locale that does not match the locales above
'/about-us',
], name: 'about_us')]
public function about(): Response
{
@@ -2240,6 +2243,9 @@ avoids the need for duplicating routes, which also reduces the potential bugs:
$routes->add('about_us', [
'en' => '/about-us',
'nl' => '/over-ons',
// optionally, you can define a path without a locale. It will be used
// for any locale that does not match the locales above
'/about-us',
])
->controller([CompanyController::class, 'about'])
;