8000 [WebProfilerBundle] Added Session Metadata info to the Request section of the WDT by dlsniper · Pull Request #4428 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[WebProfilerBundle] Added Session Metadata info to the Request section of the WDT #4428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
<b>Route name</b>
<span>{{ request_route }}</span>
</div>
<div class="sf-toolbar-info-piece">
<b>Has session</b>
<span>{% if collector.sessionmetadata|length %}yes{% else %}no{% endif %}</span>
</div>
{% endspaceless %}
{% endset %}
{% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { 'link': profiler_url } %}
Expand Down Expand Up @@ -109,6 +113,16 @@

{% 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>

{% if collector.sessionattributes|length %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@ public function collect(Request $request, Response $response, \Exception $except
$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(
'format' => $request->getRequestFormat(),
'content' => $content,
Expand All @@ -71,6 +79,7 @@ public function collect(Request $request, Response $response, \Exception $except
'request_cookies' => $request->cookies->all(),
'request_attributes' => $attributes,
'response_headers' => $responseHeaders,
'session_metadata' => $sessionMetadata,
'session_attributes' => $request->hasSession() ? $request->getSession()->all() : array(),
'flashes' => $request->hasSession() ? $request->getSession()->getFlashBag()->peekAll() : array(),
'path_info' => $request->getPathInfo(),
Expand Down Expand Up @@ -117,6 +126,11 @@ public function getResponseHeaders()
return new ResponseHeaderBag($this->data['response_headers']);
}

public function getSessionMetadata()
{
return $this->data['session_metadata'];
}

public function getSessionAttributes()
{
return $this->data['session_attributes'];
Expand Down
0