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] Fixed priority getting lost when setting localized prefix#52913

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

Merged
nicolas-grekas merged 1 commit intosymfony:5.4fromSystematicCZ:fix_52912
Jan 30, 2024

Conversation

SystematicCZ
Copy link

@SystematicCZSystematicCZ commentedDec 6, 2023
edited
Loading

QA
Branch?5.4
Bug fix?yes
New feature?no
Deprecations?no
IssuesFix#52912
LicenseMIT

When a route prefix is an array, the original route is removed from the collection and then re-added with a new name and path. During this process, the route's priority is lost as it's not preserved during the removal and re-addition.

Current state ofPrefixTrait.php

$routes->remove($name);...$routes->add($name.'.'.$locale,$localizedRoute);

To resolve this issue, I implemented a change where the priority of the route is stored before removal. This stored priority is then reassigned to the route when it's added back to the collection.

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.1 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@SystematicCZSystematicCZforce-pushed thefix_52912 branch 2 times, most recently from5a1519e to347a471CompareDecember 6, 2023 13:39
Copy link
Member

@nicolas-grekasnicolas-grekas left a comment

Choose a reason for hiding this comment

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

I'm annoyed by the need for adding a method but I don't see any other non-hacky way.
Since this issue exists in 5.4, can you please rebase/retarget the PR for 5.4?

@nicolas-grekasnicolas-grekas modified the milestones:6.4,5.4Jan 29, 2024
@SystematicCZ
Copy link
Author

Thx. I will rebase tommorow.

{
new LoaderResolver([
$loader = new YamlFileLoader(new FileLocator(\dirname(__DIR__).'/Fixtures/localized')),
new class() extends AttributeClassLoader {
Copy link
Member

@nicolas-grekasnicolas-grekasJan 30, 2024
edited
Loading

Choose a reason for hiding this comment

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

This class doesn't exist in 5.4.
Maybe we can define the routes using plain yaml or xml instead so that we don't have to deal with this concern (migrating from annotations to attributes when merging up ;) )

Copy link
Author

Choose a reason for hiding this comment

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

Ok, thats a good idea. I will fix

Copy link
Author

@SystematicCZSystematicCZJan 30, 2024
edited
Loading

Choose a reason for hiding this comment

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

According to docs priority can be set only in annotations or attributes. So I don't see a clear way how to test this easily on 5.4 and 6 without changing the code between those

In YAML and XML you can move the route definitions up or down in the configuration file to control their priority. In routes defined as PHP attributes this is much harder to do, so you can set the optional priority parameter in those routes to control their priority

nicolas-grekas reacted with thumbs up emoji
@nicolas-grekas
Copy link
Member

Thank you@SystematicCZ.

@nicolas-grekasnicolas-grekas merged commit0566c39 intosymfony:5.4Jan 30, 2024
@SystematicCZSystematicCZ deleted the fix_52912 branchJanuary 30, 2024 13:16
This was referencedJan 30, 2024
@fabpotfabpot mentioned this pull requestJan 31, 2024
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

Assignees
No one assigned
Projects
None yet
Milestone
5.4
Development

Successfully merging this pull request may close these issues.

3 participants
@SystematicCZ@carsonbot@nicolas-grekas

[8]ページ先頭

©2009-2025 Movatter.jp