diff --git a/src/Symfony/Bundle/SwiftmailerBundle/DataCollector/MessageDataCollector.php b/src/Symfony/Bundle/SwiftmailerBundle/DataCollector/MessageDataCollector.php index 1b192239b8..d038159e47 100644 --- a/src/Symfony/Bundle/SwiftmailerBundle/DataCollector/MessageDataCollector.php +++ b/src/Symfony/Bundle/SwiftmailerBundle/DataCollector/MessageDataCollector.php @@ -24,12 +24,12 @@ use Symfony\Component\HttpFoundation\Response; class MessageDataCollector extends DataCollector { protected $logger; - + protected $mailer; + public function __construct(\Swift_Events_SendListener $logger, \Swift_Mailer $mailer) { $this->logger = $logger; - // we do nothing with the mailer - // it's in the constructor just to force SwiftMailer to be initialized + $this->mailer = $mailer; } /** @@ -37,8 +37,9 @@ class MessageDataCollector extends DataCollector */ public function collect(Request $request, Response $response, \Exception $exception = null) { - $this->data['messages'] = $this->logger->getMessages(); + $this->data['messages'] = $this->logger->getMessages(); $this->data['messageCount'] = $this->logger->countMessages(); + $this->data['isSpool'] = $this->mailer->getTransport() instanceof \Swift_Transport_SpoolTransport; } public function getMessageCount() @@ -50,6 +51,11 @@ class MessageDataCollector extends DataCollector { return $this->data['messages']; } + + public function isSpool() + { + return $this->data['isSpool']; + } /** * {@inheritdoc} @@ -58,4 +64,4 @@ class MessageDataCollector extends DataCollector { return 'swiftmailer'; } -} +} \ No newline at end of file diff --git a/src/Symfony/Bundle/SwiftmailerBundle/Resources/views/Collector/swiftmailer.html.twig b/src/Symfony/Bundle/SwiftmailerBundle/Resources/views/Collector/swiftmailer.html.twig index a3d15037a8..196d08dff2 100644 --- a/src/Symfony/Bundle/SwiftmailerBundle/Resources/views/Collector/swiftmailer.html.twig +++ b/src/Symfony/Bundle/SwiftmailerBundle/Resources/views/Collector/swiftmailer.html.twig @@ -23,7 +23,7 @@ {% endblock %} {% block panel %} -

Messages sent

+

Messages {% if not collector.isSpool %} sent {% else %} spooled {% endif %}

{% if not collector.messages %}