Change Message sent text to Message spooled if we are in a spool context

This commit is contained in:
Clément Jobeili 2011-03-21 09:01:50 +01:00
parent a505ff43b5
commit f8dead7782
2 changed files with 12 additions and 6 deletions

View File

@ -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;
}
/**
@ -39,6 +39,7 @@ class MessageDataCollector extends DataCollector
{
$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()
@ -51,6 +52,11 @@ class MessageDataCollector extends DataCollector
return $this->data['messages'];
}
public function isSpool()
{
return $this->data['isSpool'];
}
/**
* {@inheritdoc}
*/

View File

@ -23,7 +23,7 @@
{% endblock %}
{% block panel %}
<h2>Messages sent</h2>
<h2>Messages {% if not collector.isSpool %} sent {% else %} spooled {% endif %}</h2>
{% if not collector.messages %}
<p>