-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Can not create links from routes with optional parameters #46
Comments
The problem is that you have an optional segment followed by required segments. This has always had problematic behavior, and we do not recommend it. Instead, create two separate routes, one that does not have the |
In our project we have in summary 9 routes with this optional Parameter. We had duplicated routes before for some of them, until we found out in Zend MVC does this kind of routing work. Our problem with duplicated routes was, that we forget often to change the second one. |
Please leave this open. This happens also for routing without any non-optional postfixes.... We have a very simple route defined: (this is just a extension of the skeleton app)
With the same result during building the url:
We have researched a little bit on this and found out, that the "name" parameter is added to the options here: Which results in the options parameter "has_child" parameter here: Which than results in this invalid argument exception: |
@jscssphtml new issue, perhaps with test case, would be nice |
I guess that this issue is better placed in https://github.com/mezzio/mezzio-laminasrouter as that seems to be a specific laminas-router issue rather than a mezzio issue. |
Bug Report
Summary
Current behavior
Actually I have an Zend MVC Application with the following routing:
I'm using this call to generate an Uri in a view script:
The generated Uri is "/wizard/1/os09t2ujphehcbvp7nr7fgs5ei".
I'm trying to rewrite that Application to an Mezzio Application.
The new Route configuration is:
The new Call in a view script has to be:
The generated Uri is now "/wizard//2/2d5d501b4a0f1d8caa171258e8821a54". (With double Slash)
If I set the "embed" parameter to null or don't set default, I get this Exception:
How to reproduce
Expected behavior
It is possible to set an optional Parameter to null and the Parameter is not in the generated Uri.
The text was updated successfully, but these errors were encountered: