Преглед на файлове

[SwiftmailerBundle] fixed the send email command when the queue does not extends Swift_ConfigurableSpool

Fabien Potencier преди 13 години
родител
ревизия
9e38d6a18f
променени са 1 файла, в които са добавени 4 реда и са изтрити 2 реда
  1. 4 2
      src/Symfony/Bundle/SwiftmailerBundle/Command/SendEmailCommand.php

+ 4 - 2
src/Symfony/Bundle/SwiftmailerBundle/Command/SendEmailCommand.php

@@ -54,8 +54,10 @@ EOF
 
         if ($transport instanceof \Swift_Transport_SpoolTransport) {
             $spool = $transport->getSpool();
-            $spool->setMessageLimit($input->getOption('message-limit'));
-            $spool->setTimeLimit($input->getOption('time-limit'));
+            if ($spool instanceof \Swift_ConfigurableSpool) {
+                $spool->setMessageLimit($input->getOption('message-limit'));
+                $spool->setTimeLimit($input->getOption('time-limit'));
+            }
             $sent = $spool->flushQueue($this->getContainer()->get('swiftmailer.transport.real'));
 
             $output->writeln(sprintf('sent %s emails', $sent));