Added Session Metadata info to the Request section of the WDT
This commit is contained in:
parent
9e9519913d
commit
8dd2af77a4
@ -34,6 +34,10 @@
|
|||||||
<b>Route name</b>
|
<b>Route name</b>
|
||||||
<span>{{ request_route }}</span>
|
<span>{{ request_route }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="sf-toolbar-info-piece">
|
||||||
|
<b>Has session</b>
|
||||||
|
<span>{% if collector.sessionmetadata|length %}yes{% else %}no{% endif %}</span>
|
||||||
|
</div>
|
||||||
{% endspaceless %}
|
{% endspaceless %}
|
||||||
{% endset %}
|
{% endset %}
|
||||||
{% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { 'link': profiler_url } %}
|
{% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { 'link': profiler_url } %}
|
||||||
@ -109,6 +113,16 @@
|
|||||||
|
|
||||||
{% include 'WebProfilerBundle:Profiler:bag.html.twig' with { 'bag': collector.responseheaders } only %}
|
{% include 'WebProfilerBundle:Profiler:bag.html.twig' with { 'bag': collector.responseheaders } only %}
|
||||||
|
|
||||||
|
<h2>Session Metadata</h2>
|
||||||
|
|
||||||
|
{% if collector.sessionmetadata|length %}
|
||||||
|
{% include 'WebProfilerBundle:Profiler:table.html.twig' with { 'data': collector.sessionmetadata } only %}
|
||||||
|
{% else %}
|
||||||
|
<p>
|
||||||
|
<em>No session metadata</em>
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<h2>Session Attributes</h2>
|
<h2>Session Attributes</h2>
|
||||||
|
|
||||||
{% if collector.sessionattributes|length %}
|
{% if collector.sessionattributes|length %}
|
||||||
|
@ -59,6 +59,14 @@ class RequestDataCollector extends DataCollector
|
|||||||
$content = false;
|
$content = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sessionMetadata = array();
|
||||||
|
|
||||||
|
if ($request->hasSession()) {
|
||||||
|
$sessionMetadata['Created'] = date(DATE_RFC822, $request->getSession()->getMetadataBag()->getCreated());
|
||||||
|
$sessionMetadata['Last used'] = date(DATE_RFC822, $request->getSession()->getMetadataBag()->getLastUsed());
|
||||||
|
$sessionMetadata['Lifetime'] = $request->getSession()->getMetadataBag()->getLifetime();
|
||||||
|
}
|
||||||
|
|
||||||
$this->data = array(
|
$this->data = array(
|
||||||
'format' => $request->getRequestFormat(),
|
'format' => $request->getRequestFormat(),
|
||||||
'content' => $content,
|
'content' => $content,
|
||||||
@ -71,6 +79,7 @@ class RequestDataCollector extends DataCollector
|
|||||||
'request_cookies' => $request->cookies->all(),
|
'request_cookies' => $request->cookies->all(),
|
||||||
'request_attributes' => $attributes,
|
'request_attributes' => $attributes,
|
||||||
'response_headers' => $responseHeaders,
|
'response_headers' => $responseHeaders,
|
||||||
|
'session_metadata' => $sessionMetadata,
|
||||||
'session_attributes' => $request->hasSession() ? $request->getSession()->all() : array(),
|
'session_attributes' => $request->hasSession() ? $request->getSession()->all() : array(),
|
||||||
'flashes' => $request->hasSession() ? $request->getSession()->getFlashBag()->peekAll() : array(),
|
'flashes' => $request->hasSession() ? $request->getSession()->getFlashBag()->peekAll() : array(),
|
||||||
'path_info' => $request->getPathInfo(),
|
'path_info' => $request->getPathInfo(),
|
||||||
@ -117,6 +126,11 @@ class RequestDataCollector extends DataCollector
|
|||||||
return new ResponseHeaderBag($this->data['response_headers']);
|
return new ResponseHeaderBag($this->data['response_headers']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getSessionMetadata()
|
||||||
|
{
|
||||||
|
return $this->data['session_metadata'];
|
||||||
|
}
|
||||||
|
|
||||||
public function getSessionAttributes()
|
public function getSessionAttributes()
|
||||||
{
|
{
|
||||||
return $this->data['session_attributes'];
|
return $this->data['session_attributes'];
|
||||||
|
Reference in New Issue
Block a user