bug #25678 [WebProfilerBundle] set the var in the right scope (Jochen Mandl)

This PR was squashed before being merged into the 3.4 branch (closes #25678).

Discussion
----------

[WebProfilerBundle] set the var in the right scope

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

![2018-01-04 um 09 29 54](https://user-images.githubusercontent.com/1322118/34555989-de6fd11c-f134-11e7-81f7-9b840a946073.png)

This PR fixes the bug when displaying the toolbar. The variable "has_time_events" was not created in the scope of the toolbar.

Commits
-------

3e9780df59 [WebProfilerBundle] set the var in the right scope
This commit is contained in:
Javier Eguiluz 2018-01-04 12:52:27 +01:00
commit 85240f2247

View File

@ -14,9 +14,10 @@
} %}
{% endif %}
{% set has_time_events = collector.events|length > 0 %}
{% block toolbar %}
{% set has_time_events = collector.events|length > 0 %}
{% set total_time = has_time_events ? '%.0f'|format(collector.duration) : 'n/a' %}
{% set initialization_time = collector.events|length ? '%.0f'|format(collector.inittime) : 'n/a' %}
{% set status_color = has_time_events and collector.duration > 1000 ? 'yellow' : '' %}
@ -49,6 +50,7 @@
{% endblock %}
{% block panel %}
{% set has_time_events = collector.events|length > 0 %}
<h2>Performance metrics</h2>
<div class="metrics">