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

Bug: getRoutesOptions return wrong when I have >2 routes has same name, but different method (HTTPVerb) #3700

Closed
mrhung opened this issue Sep 30, 2020 · 1 comment · Fixed by #3751
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@mrhung
Copy link

mrhung commented Sep 30, 2020

//my routes

$routes->get('product/add', 'App\Product::add', ['as' => 'app_product_add']);
$routes->post('product/add', 'App\Product::add_ajax', ['as' => 'app_product_add_ajax']);

//my function
$router = \Config\Services::router();
$match = $router->getMatchedRoute(); // => IT'S OK
$options = $router->getMatchedRouteOptions(); //=> WRONG BY METHOD

$options alway is: ['as' => 'app_product_add_ajax']
I want setMethod() and default method by current request in here for return right options

How can't I hot fix this bug?

Help me.
Thanks

@mrhung mrhung added the bug Verified issues on the current code behavior or pull requests that will fix them label Sep 30, 2020
@crustamet
Copy link
Contributor

Yes i had this problem also.
It would have been nice if the system differentiate this methods in the routes also.

Because of this i changed all my segments routes to not be the same as GET and POST

ex :

get('product/add')
post('product/submit_add')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants