[Routing] Allow force-generation of trailing parameters using eg "/exports/news.{!_format}"#29599
[Routing] Allow force-generation of trailing parameters using eg "/exports/news.{!_format}"#29599nicolas-grekas merged 1 commit intosymfony:masterfrom luchaninov:master
Conversation
nicolas-grekas
left a comment
There was a problem hiding this comment.
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.
Move before if so else can be removed.
There was a problem hiding this comment.
or in one line: if ($important = '!' === $varName[0]) {
There was a problem hiding this comment.
@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
…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_formatbe defined indefaultsand the generator should generate URLs with that default when none is provided (should work with any parameter of course).