[WebProfiler] Add info to the router panel

This commit is contained in:
Victor Berchet 2012-02-06 19:08:49 +01:00
parent aa1676c7b5
commit 50c85aef24
2 changed files with 28 additions and 18 deletions

View File

@ -42,11 +42,11 @@ class RouterController extends ContainerAware
$profile = $profiler->loadProfile($token);
$matcher = new TraceableUrlMatcher($router->getRouteCollection(), $router->getContext());
$pathinfo = $profile->getCollector('request')->getPathInfo();
$request = $profile->getCollector('request');
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Router:panel.html.twig', array(
'pathinfo' => $pathinfo,
'traces' => $matcher->getTraces($pathinfo),
'request' => $request,
'traces' => $matcher->getTraces($request->getPathInfo()),
));
}
}

View File

@ -1,16 +1,26 @@
<h2>Routing for "{{ pathinfo }}"</h2>
<h2>Routing for "{{ request.pathinfo }}"</h2>
<table class="routing">
<tr>
<th>Route name</th>
<th>Pattern</th>
<th>Log</th>
</tr>
{% for trace in traces %}
<tr class="{{ 1 == trace.level ? 'almost' : 2 == trace.level ? 'matches' : '' }}">
<td>{{ trace.name }}</td>
<td>{{ trace.pattern }}</td>
<td>{{ trace.log }}</td>
</tr>
{% endfor %}
</table>
<ul>
<li><strong>Route:&nbsp;</strong>{{ request.route }}</li>
<li>
<strong>Route parameters:</strong>
{% include 'WebProfilerBundle:Profiler:table.html.twig' with { 'data': request.routeParams } only %}
</li>
<li>
<strong>Route matching:</strong>
<table class="routing">
<tr>
<th>Route name</th>
<th>Pattern</th>
<th>Log</th>
</tr>
{% for trace in traces %}
<tr class="{{ 1 == trace.level ? 'almost' : 2 == trace.level ? 'matches' : '' }}">
<td>{{ trace.name }}</td>
<td>{{ trace.pattern }}</td>
<td>{{ trace.log }}</td>
</tr>
{% endfor %}
</table>
</li>