Skip to content

Commit 3896fdd

Browse files
committed
[WebProfilerBundle] Some cleanup
1 parent aa1676c commit 3896fdd

File tree

5 files changed

+41
-30
lines changed

5 files changed

+41
-30
lines changed

src/Symfony/Bundle/FrameworkBundle/DataCollector/RequestDataCollector.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public function collect(Request $request, Response $response, \Exception $except
3737
{
3838
parent::collect($request, $response, $exception);
3939

40-
$this->data['route'] = $request->attributes->get('_route');
4140
$this->data['controller'] = 'n/a';
4241

4342
if (isset($this->controllers[$request])) {
@@ -71,7 +70,17 @@ public function onKernelController(FilterControllerEvent $event)
7170
*/
7271
public function getRoute()
7372
{
74-
return $this->data['route'];
73+
return $this->data['request_attributes']['_route'];
74+
}
75+
76+
/**
77+
* Returns the route parameters.
78+
*
79+
* @return array The parameters
80+
*/
81+
public function getRouteParams()
82+
{
83+
return $this->data['request_attributes']['_route_params'];
7584
}
7685

7786
/**

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,7 @@
9696
<h2>Session Attributes</h2>
9797

9898
{% if collector.sessionattributes|length %}
99-
<table>
100-
<thead>
101-
<tr>
102-
<th scope="col">Key</th>
103-
<th scope="col">Value</th>
104-
</tr>
105-
</thead>
106-
<tbody>
107-
{% set attributes = collector.sessionattributes %}
108-
{% for key in attributes|keys|sort %}
109-
<tr>
110-
<th>{{ key }}</th>
111-
<td>{{ attributes[key]|yaml_dump }}</td>
112-
</tr>
113-
{% endfor %}
114-
</tbody>
115-
</table>
99+
{% include 'WebProfilerBundle:Profiler:table.html.twig' with { 'data': collector.sessionattributes } only %}
116100
{% else %}
117101
<p>
118102
<em>No session attributes</em>
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
<table>
2-
<thead>
3-
<tr>
4-
<th scope="col">Key</th>
5-
<th scope="col">Value</th>
6-
</tr>
7-
</thead>
8-
<tbody>
9-
{% for key in bag.keys|sort %}
1+
<table {% if class is defined %}class='{{ class }}'{% endif %} >
2+
<thead>
3+
<tr>
4+
<th scope="col">Key</th>
5+
<th scope="col">Value</th>
6+
</tr>
7+
</thead>
8+
<tbody>
9+
{% for key in bag.keys|sort %}
1010
<tr>
1111
<th>{{ key }}</th>
1212
<td>{{ bag.get(key)|yaml_dump }}</td>
1313
</tr>
14-
{% endfor %}
15-
</tbody>
14+
{% endfor %}
15+
</tbody>
1616
</table>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<table {% if class is defined %}class='{{ class }}'{% endif %} >
2+
<thead>
3+
<tr>
4+
<th scope="col">Key</th>
5+
<th scope="col">Value</th>
6+
</tr>
7+
</thead>
8+
<tbody>
9+
{% for key in data|keys|sort %}
10+
<tr>
11+
<th>{{ key }}</th>
12+
<td>{{ data[key]|yaml_dump }}</td>
13+
</tr>
14+
{% endfor %}
15+
</tbody>
16+
</table>

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Router/panel.html.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@
1414
</tr>
1515
{% endfor %}
1616
</table>
17+
<em><small>Note: The above matching is based on the configuration for the current router which might differ from
18+
the configuration used while routing this request.</small></em>

0 commit comments

Comments
 (0)