Skip to content
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

Route does not exist with localized path #354

Open
vklepper opened this issue Feb 22, 2019 · 3 comments
Open

Route does not exist with localized path #354

vklepper opened this issue Feb 22, 2019 · 3 comments

Comments

@vklepper
Copy link

vklepper commented Feb 22, 2019

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?

@florianajir
Copy link

florianajir commented Mar 15, 2019

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

@vklepper
Copy link
Author

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 ! 👍

@tobias-93
Copy link
Collaborator

Is this still an issue with #334 merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants