fixed exception in the profile/WDT when no route matches

This commit is contained in:
Fabien Potencier 2012-02-12 13:51:16 +01:00
parent 1e79e30c7b
commit 8365675fc2
2 changed files with 12 additions and 5 deletions

View File

@ -70,7 +70,7 @@ class RequestDataCollector extends BaseRequestDataCollector
*/
public function getRoute()
{
return $this->data['request_attributes']['_route'];
return isset($this->data['request_attributes']['_route']) ? $this->data['request_attributes']['_route'] : '';
}
/**
@ -80,7 +80,7 @@ class RequestDataCollector extends BaseRequestDataCollector
*/
public function getRouteParams()
{
return $this->data['request_attributes']['_route_params'];
return isset($this->data['request_attributes']['_route_params']) ? $this->data['request_attributes']['_route_params'] : array();
}
/**

View File

@ -1,9 +1,16 @@
<h2>Routing for "{{ request.pathinfo }}"</h2>
<ul>
<li><strong>Route:&nbsp;</strong>{{ request.route }}</li>
<li>
<strong>Route parameters:</strong>
<strong>Route:&nbsp;</strong>
{% if request.route %}
{{ request.route }}
{% else %}
<em>No matching route</em>
{% endif %}
</li>
<li>
<strong>Route parameters:&nbsp;</strong>
{% if request.routeParams|length %}
{% include 'WebProfilerBundle:Profiler:table.html.twig' with { 'data': request.routeParams, 'class': 'inline' } only %}
{% else %}
@ -16,7 +23,7 @@
<li>
{% endif %}
<li>
<strong>Route matching:</strong>
<strong>Route matching logs</strong>
<table class="routing inline">
<tr>
<th>Route name</th>