Skip to content
This repository was archived by the owner on Feb 6, 2022. It is now read-only.

Commit 0b06066

Browse files
committed
bug #152 Displayed attachment filename in the profiler (lyrixx)
This PR was merged into the 2.4-dev branch. Discussion ---------- Displayed attachment filename in the profiler ![screenshot9](https://cloud.githubusercontent.com/assets/408368/21153600/7c209086-c16b-11e6-876f-1b948929e61d.png) Commits ------- 36b4e3e Displayed attachment filename in the profiler
2 parents e7e2340 + 36b4e3e commit 0b06066

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

DataCollector/MessageDataCollector.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,19 @@ public function isDefaultMailer($name)
145145
return $this->data['defaultMailer'] == $name;
146146
}
147147

148+
public function extractAttachments(\Swift_Message $message)
149+
{
150+
$attachments = array();
151+
152+
foreach ($message->getChildren() as $child) {
153+
if ($child instanceof \Swift_Attachment) {
154+
$attachments[] = $child;
155+
}
156+
}
157+
158+
return $attachments;
159+
}
160+
148161
/**
149162
* {@inheritdoc}
150163
*/

Resources/views/Collector/swiftmailer.html.twig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,28 @@
175175
</pre>
176176
</div>
177177
{% endfor %}
178+
179+
{% set attachments = collector.extractAttachments(message) %}
180+
{% if attachments %}
181+
<div class="card-block">
182+
<span class="label">
183+
{% if attachments|length > 1 %}
184+
{{ attachments|length }} Attachments
185+
{% else %}
186+
1 Attachment
187+
{% endif %}
188+
</span>
189+
190+
<ol>
191+
{% for attachment in attachments %}
192+
<li>
193+
Filename:
194+
{{ attachment.filename }}
195+
</li>
196+
{% endfor %}
197+
</ol>
198+
</div>
199+
{% endif %}
178200
</div>
179201
{% endfor %}
180202
{% endif %}

0 commit comments

Comments
 (0)