Skip to content

[Routing] add priority option to annotated routes #35608

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

Merged
merged 1 commit into from
Feb 5, 2020

Conversation

nicolas-grekas
Copy link
Member

Q A
Branch? master
Bug fix? no
New feature? yes
Deprecations? yes
Tickets Fix #26132
License MIT
Doc PR -

This PR allows defining the priority of routes using annotations:
@Route(name="foo", priority=10)

As requested in this comment, priority is reserved to using annotations. For other formats, the order works fine.

@fabpot
Copy link
Member

fabpot commented Feb 5, 2020

Thank you @nicolas-grekas.

fabpot added a commit that referenced this pull request Feb 5, 2020
…olas-grekas)

This PR was merged into the 5.1-dev branch.

Discussion
----------

[Routing] add priority option to annotated routes

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | yes
| Tickets       | Fix  #26132
| License       | MIT
| Doc PR        | -

This PR allows defining the priority of routes using annotations:
`@Route(name="foo", priority=10)`

As requested [in this comment](#26132 (review)), priority is reserved to using annotations. For other formats, the order works fine.

Commits
-------

8522a83 [Routing] add priority option to annotated routes
@fabpot fabpot merged commit 8522a83 into symfony:master Feb 5, 2020
@nicolas-grekas nicolas-grekas deleted the route-annot-prio branch February 7, 2020 11:42
@UBERPHP
Copy link

UBERPHP commented Feb 9, 2020

thank you, I was waiting for this more than 1 year 👍

@xmontero
Copy link

Reading here https://symfony.com/blog/new-in-symfony-5-1-route-annotations-priority and here https://symfony.com/doc/current/routing.html#priority-parameter it is not clear if the "priority" only applies to the annotations or it's something "general" that can also be configured in the yaml or xml definition.

Having this documented (and in the case it's only a thing of the annotations, having that also in the yaml or xml) can be useful when multiple files are loaded from the config/routes folder and one catch-all like /{destination} overwrites another one that should be used like /logout and they are defined in different files so no availability to move the route up or down in the same file.

Questions:

a) Does this only apply to the annotations or the routes themselves?
b) If only annotations => Should we have this also in the core?
c) If also in the yaml/xml => Should we update the documentation to avoid confusion?

Thnx!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants