-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Routing] 'host' routes using 'requirements' does not pass through mandatory parameters #7538
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
Sorry I read your description like 10 times and still don't understand what you describe. For a bug report please say what the actual behavior is and what the expected behavior is. Also consider using the mailing list for support questions. |
if there is no: host: acme.{tld} but instead: host: acme.dev it works fine. the problem occurs when using host and requirements together. |
You have to pass the |
does #6857 elaborate on how to pass a parameter when generating a route? Ive read the ticket but Im not sure how to fix that issue. |
Just as you pass any other parameter when generating a route. |
I shall try and find some more documentation on how to do that. thank you. |
after further research and discussion on the symfony irc channel I believe that there is no obvious solution by 'passing a parameter', afterall it works for as long as there is no prefix instruction used to pull in more routes (that are generated) - so this must be a bug or an incomplete implementation of the host matching feature. it works with a simplified usecase, but not when using extra routes with prefix. or am I wrong, and you could give me an example on how to fix this without having to rewrite everything the crud form generator produced? |
So this is a problem with the crud generator and not really the routing component as you describe in the title. |
@FunTimeCoding This comment can help you #3965 (comment) |
thanks. |
So I have this in my app/config/routing.yml:
acme_store_dev:
resource: "@AcmeStoreBundle/Resources/config/routing.yml"
host: acme.{tld}
requirements:
tld: dev|org
and something like this in the bundles routing.yml:
acme_store_homepage:
pattern: /hello/{name}
defaults: { _controller: AcmeStoreBundle:Default:index }
acme_store_product:
resource: "@AcmeStoreBundle/Resources/config/routing/product.yml"
prefix: /product
and the product.yml contains several auto generated routes like that:
product_show:
pattern: /{id}/show
defaults: { _controller: "AcmeStoreBundle:Product:show" }
The problem is within the first configuration. If I only use one host and no tld matching (and any other form of regex matching in hosts) itll lead to this kind of error:
An exception has been thrown during the rendering of a template ("Some mandatory parameters are missing ("tld") to generate a URL for route "category_new".") in AcmeStoreBundle:Category:index.html.twig at line 36.
I could now start rewriting all that the crud generator made for me or stop using that form of host matching, but Id really like to use those two features - any suggestions? is this a bug that can be fixed? from what I understand the /prefix is supposed to map route extensions dynamically, and independent of any prior routes, which is also quite nifty to have.
The text was updated successfully, but these errors were encountered: