Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

@santysisi
Copy link
Contributor

QA
Branch?7.4
Bug fix?no
New feature?yes
Deprecations?yes
IssuesFix#61344
LicenseMIT

Summary

This PR enhances theSymfony\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 bothdev andtest environments, two separate route attributes were needed:

#[Route('/test', name:'test', env:'dev')]#[Route('/test', name:'test-testing', env:'test')]

After

Now, the same can be achieved with a single attribute by passing an array:

#[Route('/test', name:'test', env: ['dev','test'])]

@santysisi
Copy link
ContributorAuthor

I'm not entirely sure if this qualifies as a breaking change 🤔
If it is, I can update theUPGRADE.md and change the target branch from7.4 to8.0.

@santysisi
Copy link
ContributorAuthor

I believe the errors in this PR will be resolved byPR #61360 😄.

@santysisisantysisiforce-pushed thefeature/support-multiple-envs-in-route-attribute branch 3 times, most recently frombf489ae toa1ef1eeCompareAugust 8, 2025 22:10
@santysisisantysisiforce-pushed thefeature/support-multiple-envs-in-route-attribute branch 2 times, most recently fromdbeae07 to4b5d99dCompareAugust 9, 2025 13:30
@santysisi
Copy link
ContributorAuthor

I think the errors aren't relevant in the context of this PR

@santysisisantysisiforce-pushed thefeature/support-multiple-envs-in-route-attribute branch from4b5d99d to67d8e1eCompareAugust 10, 2025 20:08
@santysisisantysisiforce-pushed thefeature/support-multiple-envs-in-route-attribute branch from67d8e1e todcb540cCompareAugust 10, 2025 21:53
@santysisi
Copy link
ContributorAuthor

@GromNaN Thanks a lot for all your suggestions! I’ve made the changes ❤️

@santysisisantysisiforce-pushed thefeature/support-multiple-envs-in-route-attribute branch 2 times, most recently from5fc6707 to2f6564aCompareAugust 16, 2025 23:32
return$this->env[0];
}

publicfunctionsetEnvs(array|string$env):void

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why do we have setters at all?

santysisi reacted with heart emoji
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I think adding the setter helps keep consistency with the current class design. But if you feel it’s unnecessary, I can remove it
just let me know 🫡

@santysisisantysisiforce-pushed thefeature/support-multiple-envs-in-route-attribute branch from2f6564a to4dbbedeCompareAugust 19, 2025 23:20
@santysisisantysisiforce-pushed thefeature/support-multiple-envs-in-route-attribute branch from4dbbede to2ad7ff3CompareAugust 19, 2025 23:21
@santysisi
Copy link
ContributorAuthor

santysisi commentedAug 19, 2025
edited
Loading

Thanks for the suggestions! 🙌
I’ve made the changes

@nicolas-grekasnicolas-grekasforce-pushed thefeature/support-multiple-envs-in-route-attribute branch from2ad7ff3 to525ec95CompareAugust 20, 2025 06:50
@nicolas-grekas
Copy link
Member

Thank you@santysisi.

santysisi and andreybolonin reacted with hooray emojisantysisi reacted with heart emojisantysisi reacted with rocket emoji

@nicolas-grekasnicolas-grekas merged commit6726234 intosymfony:7.4Aug 20, 2025
7 of 12 checks passed
This was referencedOct 27, 2025
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@GromNaNGromNaNGromNaN approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

7.4

Development

Successfully merging this pull request may close these issues.

[Routing] make it possible so that env parameter can set a array

4 participants

@santysisi@nicolas-grekas@GromNaN@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp