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

[Routing] Fix routing collection defaults when adding a new route to a collection #51704

Merged
merged 1 commit into from
Sep 20, 2023

Conversation

bram123
Copy link
Contributor

@bram123 bram123 commented Sep 20, 2023

Q A
Branch? 6.3
Bug fix? yes
New feature? no
Deprecations? no
Tickets ~
License MIT
Doc PR ~

In our current Symfony project we use PHP routing files, and use routing collections that are setup before adding routes.

Before upgrading to Symfony 6.3 this meant we could add an attribute to the collection, add X routes and they would all have this routing attribute (be it stateless / methods / defaults). After upgrading to S6.3 this no longer works.

PR #49517 removed the createRoute method from the CollectionConfigurator, because it was thought to be unused, but this method was used when adding a new Route to a RouteCollection. Without the method, the createRoute method of the LocalizedRouteTrait was used.
This means that when setting up a route collection before adding routes, the new routes no longer get the collection settings.

Added a new unittest to prevent this from happening again. For now only added to the PhpFileLoaderTest, I don't know if this is also possible for XML/YML routing config to also add a test in those LoaderTests.

@bram123 bram123 changed the title Fix routing collection defaults when adding a new route to a collection. [Routing] Fix routing collection defaults when adding a new route to a collection. Sep 20, 2023
@bram123
Copy link
Contributor Author

bram123 commented Sep 20, 2023

Test failures are (hopefully) unrelated; or did I do something wrong?

@nicolas-grekas nicolas-grekas changed the title [Routing] Fix routing collection defaults when adding a new route to a collection. [Routing] Fix routing collection defaults when adding a new route to a collection Sep 20, 2023
@nicolas-grekas
Copy link
Member

Good catch, thanks @bram123.

@nicolas-grekas nicolas-grekas merged commit 93afb42 into symfony:6.3 Sep 20, 2023
4 of 9 checks passed
@bram123 bram123 deleted the routing_collection_defaults branch September 20, 2023 16:31
@nicolas-grekas nicolas-grekas modified the milestones: 6.4, 6.3 Sep 25, 2023
@fabpot fabpot mentioned this pull request Sep 30, 2023
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.

None yet

3 participants