bug #13421 [FrameworkBundle] fix routing descriptor for options (Tobion)
This PR was merged into the 2.5 branch.
Discussion
----------
[FrameworkBundle] fix routing descriptor for options
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
The markdown descriptor for routes missed brackets, so that the `options` where actually ignored. Also fixed some other inconsistencies.
Commits
-------
b0c29a0
[FrameworkBundle] fix routing descriptor for options
This commit is contained in:
commit
b53ceb1fb6
@ -56,7 +56,7 @@ class MarkdownDescriptor extends Descriptor
|
|||||||
."\n".'- Method: '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY')
|
."\n".'- Method: '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY')
|
||||||
."\n".'- Class: '.get_class($route)
|
."\n".'- Class: '.get_class($route)
|
||||||
."\n".'- Defaults: '.$this->formatRouterConfig($route->getDefaults())
|
."\n".'- Defaults: '.$this->formatRouterConfig($route->getDefaults())
|
||||||
."\n".'- Requirements: '.$this->formatRouterConfig($requirements) ?: 'NONE'
|
."\n".'- Requirements: '.($requirements ? $this->formatRouterConfig($requirements) : 'NO CUSTOM')
|
||||||
."\n".'- Options: '.$this->formatRouterConfig($route->getOptions());
|
."\n".'- Options: '.$this->formatRouterConfig($route->getOptions());
|
||||||
|
|
||||||
$this->write(isset($options['name'])
|
$this->write(isset($options['name'])
|
||||||
|
@ -79,7 +79,7 @@ class TextDescriptor extends Descriptor
|
|||||||
'<comment>Method</comment> '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY'),
|
'<comment>Method</comment> '.($route->getMethods() ? implode('|', $route->getMethods()) : 'ANY'),
|
||||||
'<comment>Class</comment> '.get_class($route),
|
'<comment>Class</comment> '.get_class($route),
|
||||||
'<comment>Defaults</comment> '.$this->formatRouterConfig($route->getDefaults()),
|
'<comment>Defaults</comment> '.$this->formatRouterConfig($route->getDefaults()),
|
||||||
'<comment>Requirements</comment> '.$this->formatRouterConfig($requirements) ?: 'NO CUSTOM',
|
'<comment>Requirements</comment> '.($requirements ? $this->formatRouterConfig($requirements) : 'NO CUSTOM'),
|
||||||
'<comment>Options</comment> '.$this->formatRouterConfig($route->getOptions()),
|
'<comment>Options</comment> '.$this->formatRouterConfig($route->getOptions()),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -306,6 +306,10 @@ class TextDescriptor extends Descriptor
|
|||||||
*/
|
*/
|
||||||
private function formatRouterConfig(array $array)
|
private function formatRouterConfig(array $array)
|
||||||
{
|
{
|
||||||
|
if (!count($array)) {
|
||||||
|
return 'NONE';
|
||||||
|
}
|
||||||
|
|
||||||
$string = '';
|
$string = '';
|
||||||
ksort($array);
|
ksort($array);
|
||||||
foreach ($array as $name => $value) {
|
foreach ($array as $name => $value) {
|
||||||
|
@ -9,3 +9,7 @@
|
|||||||
- `name`: Joseph
|
- `name`: Joseph
|
||||||
- Requirements:
|
- Requirements:
|
||||||
- `name`: [a-z]+
|
- `name`: [a-z]+
|
||||||
|
- Options:
|
||||||
|
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
|
||||||
|
- `opt1`: val1
|
||||||
|
- `opt2`: val2
|
||||||
|
@ -6,4 +6,8 @@
|
|||||||
- Method: PUT|POST
|
- Method: PUT|POST
|
||||||
- Class: Symfony\Component\Routing\Route
|
- Class: Symfony\Component\Routing\Route
|
||||||
- Defaults: NONE
|
- Defaults: NONE
|
||||||
- Requirements: NONE
|
- Requirements: NO CUSTOM
|
||||||
|
- Options:
|
||||||
|
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
|
||||||
|
- `opt1`: val1
|
||||||
|
- `opt2`: val2
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
<comment>Scheme</comment> http|https
|
<comment>Scheme</comment> http|https
|
||||||
<comment>Method</comment> PUT|POST
|
<comment>Method</comment> PUT|POST
|
||||||
<comment>Class</comment> Symfony\Component\Routing\Route
|
<comment>Class</comment> Symfony\Component\Routing\Route
|
||||||
<comment>Defaults</comment>
|
<comment>Defaults</comment> NONE
|
||||||
<comment>Requirements</comment>
|
<comment>Requirements</comment> NO CUSTOM
|
||||||
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler
|
<comment>Options</comment> compiler_class: Symfony\Component\Routing\RouteCompiler
|
||||||
opt1: val1
|
opt1: val1
|
||||||
opt2: val2
|
opt2: val2
|
@ -12,6 +12,10 @@ route_1
|
|||||||
- `name`: Joseph
|
- `name`: Joseph
|
||||||
- Requirements:
|
- Requirements:
|
||||||
- `name`: [a-z]+
|
- `name`: [a-z]+
|
||||||
|
- Options:
|
||||||
|
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
|
||||||
|
- `opt1`: val1
|
||||||
|
- `opt2`: val2
|
||||||
|
|
||||||
|
|
||||||
route_2
|
route_2
|
||||||
@ -25,4 +29,8 @@ route_2
|
|||||||
- Method: PUT|POST
|
- Method: PUT|POST
|
||||||
- Class: Symfony\Component\Routing\Route
|
- Class: Symfony\Component\Routing\Route
|
||||||
- Defaults: NONE
|
- Defaults: NONE
|
||||||
- Requirements: NONE
|
- Requirements: NO CUSTOM
|
||||||
|
- Options:
|
||||||
|
- `compiler_class`: Symfony\Component\Routing\RouteCompiler
|
||||||
|
- `opt1`: val1
|
||||||
|
- `opt2`: val2
|
||||||
|
Reference in New Issue
Block a user