-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Routing Priority #37089
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
What does it mean? Does it break with an error? Which one? |
@nicolas-grekas: When your controller only has one method and you setting up route priority and then you create other controller also has one method (default priority is 0) The route priority mechanism is not work properly |
What exactly does that mean? What route is matched for which request and which request did you expect to be matched instead? |
@xabbuh : when read the blog (https://symfony.com/blog/new-in-symfony-5-1-route-annotations-priority), route priority only work when your controller have two or greater method in controller As i mention in example, i use But that's not work as my expectation. The |
I can confirm this. Status: Reviewed |
Looking at the implementation I think that's expected. The priority is only taken into account for the routes that are part of the same collection (i.e. are loaded from annotations of the same class). /cc @nicolas-grekas |
I don't remember :) Priorities should be preserved when merging a subcollection into a bigger one. I think that's what the code in RouteCollection::addCollection() is doing(), isn't it? |
I can confirm this too, and I found the issue, working on it... |
It should be fixed in #37176 |
@yceruto thank you so much for your awesome work 👍 |
…x to the collection (yceruto) This PR was merged into the 5.1 branch. Discussion ---------- [Routing] Keeping routes priorities after add a name prefix to the collection | Q | A | ------------- | --- | Branch? | 5.1 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #37089 | License | MIT | Doc PR | - Commits ------- 1010526 kept routes priorities after add a name prefix to the collection
Symfony version(s) affected: 5.1
Description
Routing Priority doesn't support for controller with only have one method
How to reproduce
@Route("/abc/{id}")
in :
XClassController::__invoke()
@Route("/abc/static-value-here", priority=7)
in:
YClassController::__invoke()
The text was updated successfully, but these errors were encountered: