Jelajahi Sumber

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

Fabien Potencier 13 tahun lalu
induk
melakukan
9e38d6a18f

+ 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));