-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Routing] Allow force-generation of trailing parameters using eg "/exports/news.{!_format}" #29599
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome! just a minor comment and good on my side!
Would you mind creating a doc issue/PR? |
$varName = substr($varName, 1); | ||
$coalescing = true; | ||
} else { | ||
$coalescing = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move before if
so else
can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or in one line: if ($important = '!' === $varName[0]) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nicolas-grekas nice one. To make it more understandable added ( )
:
$important = ('!' === $varName[0])
|
src/Symfony/Component/Routing/Tests/Generator/UrlGeneratorTest.php
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement 👍🏻
…xports/news.{!_format}\"
Thank you @luchaninov. |
…s using eg "/exports/news.{!_format}" (zavulon) This PR was squashed before being merged into the 4.3-dev branch (closes #29599). Discussion ---------- [Routing] Allow force-generation of trailing parameters using eg "/exports/news.{!_format}" | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #29593 | License | MIT When a route is defined as path: `/exports/news.{!_format}`, we should force `_format` be defined in `defaults` and the generator should generate URLs with that default when none is provided (should work with any parameter of course). Commits ------- 9fab3d6 [Routing] Allow force-generation of trailing parameters using eg \"/exports/news.{!_format}\"
I think the solution with |
This PR was merged into the master branch. Discussion ---------- [Router] Marking variable as important symfony/symfony#29599 Commits ------- 34f5dfa [Router] Marking variable as important
See #29763, help wanted. |
When a route is defined as path:
/exports/news.{!_format}
, we should force_format
be defined indefaults
and the generator should generate URLs with that default when none is provided (should work with any parameter of course).