-
Notifications
You must be signed in to change notification settings - Fork 39
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
Second route callback dont work in similar routes #28
Comments
AltoRouter match return only first found route. |
@websharik I think we'll need a bit more here to describe the issue in order to investigate and resolve |
I resolve this problem localy in my project, now i already sent pull request to altorouter (on accepted, your next). Problem is - callback works only on first match route. Because AltoRouter return first found route (on similar route, AltoRouter must return array of found routes) and "Upstatement/routes" accept only one route, but must accept array of routes and call callback per every founded route. Your can look my forks (similar-fix branch). |
Routes::map('test/:value_low', function($params) {
if($params["value_low"] <= 10) echo "low";
});
Routes::map('test/:value_hight', function($params) {
if($params["value_hight"] > 10) echo "hight";
}); localhost/test/8/ |
This is because your map signature for value_low will always match - changing the variable name does not change the signature. You need to use a single route and add logic to it or change the signature. |
@billybigpotatoes, Yes are your right, but when i want single route and separate logic its broken. |
I have routes:
"/flight/:city/:country" - From city to country
"/flight/:country/:city" - From country to city
On callback i check params and do somthing or nothing.
Second route callback dont work.
The text was updated successfully, but these errors were encountered: