-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[Routing] allow setting multiple envs in #[Route]
attribute
#61358
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
Open
santysisi
wants to merge
1
commit into
symfony:7.4
Choose a base branch
from
santysisi:feature/support-multiple-envs-in-route-attribute
base: 7.4
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[Routing] allow setting multiple envs in #[Route]
attribute
#61358
santysisi
wants to merge
1
commit into
symfony:7.4
from
santysisi:feature/support-multiple-envs-in-route-attribute
+60
−7
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I'm not entirely sure if this qualifies as a breaking change 🤔 |
I believe the errors in this PR will be resolved by PR #61360 😄. |
GromNaN
reviewed
Aug 8, 2025
bf489ae
to
a1ef1ee
Compare
GromNaN
reviewed
Aug 9, 2025
dbeae07
to
4b5d99d
Compare
I think the errors aren't relevant in the context of this PR |
GromNaN
reviewed
Aug 10, 2025
src/Symfony/Component/Routing/Tests/Fixtures/AttributeFixtures/RouteWithMultipleEnvs.php
Outdated
Show resolved
Hide resolved
4b5d99d
to
67d8e1e
Compare
santysisi
commented
Aug 10, 2025
src/Symfony/Component/Routing/Tests/Fixtures/AttributeFixtures/RouteWithEnv.php
Outdated
Show resolved
Hide resolved
GromNaN
reviewed
Aug 10, 2025
src/Symfony/Component/Routing/Tests/Fixtures/AttributeFixtures/RouteWithEnv.php
Outdated
Show resolved
Hide resolved
67d8e1e
to
dcb540c
Compare
@GromNaN Thanks a lot for all your suggestions! I’ve made the changes ❤️ |
GromNaN
approved these changes
Aug 11, 2025
dcb540c
to
5fc6707
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR enhances the
Symfony\Component\Routing\Attribute\Route
attribute by allowing theenv
parameter to accept an array of environment names. This change enables defining a single route that is conditionally available in multiple environments without duplicating route definitions.Before
To make a route available in both
dev
andtest
environments, two separate route attributes were needed:After
Now, the same can be achieved with a single attribute by passing an array: