FOSJsRoutingBundle icon indicating copy to clipboard operation
FOSJsRoutingBundle copied to clipboard

Route does not exist with localized path

Open vklepper opened this issue 6 years ago • 3 comments
trafficstars

I got an error when i try to generate a route with localized path :

shop_article:
 controller: App\Controller\ShopController::showArticle
 path:
   fr: boutique/article/{slug}-{id}
   en: shop/article/{slug}-{id}
   de: shop/artikel/{slug}-{id}
 requirements:
   slug: .+
   id: \d+
 options:
   expose: true

if I remove all the localized path and keep only one like that path: shop/article/{slug}-{id} , it's working. What am I doing wrong?

vklepper avatar Feb 22 '19 14:02 vklepper

try this command and check the route name and the required params to generate the route php bin/console debug:router

florianajir avatar Mar 15 '19 14:03 florianajir

omg you juste save me ! For the record, I try to generate the route by this name but without the .locale

  shop_category.fr                     ANY      ANY      ANY    /boutique/categories/{id}-{slug}                
  shop_category.en                     ANY      ANY      ANY    /shop/categories/{id}-{slug}                    
  shop_category.de                     ANY      ANY      ANY    /shop/kategorien/{id}-{slug}  
const locale = '{{ app.request.locale }}';
Routing.generate('shop_article.' + locale, {id: article.id, slug: article.slug})

Thx @florianajir ! :+1:

vklepper avatar Mar 15 '19 16:03 vklepper

Is this still an issue with #334 merged?

tobias-93 avatar Aug 10 '19 15:08 tobias-93