浏览代码

[Swiftmailer] changed disable_strategy behavior

The blackhole plugin that was used previously stop the propagation
of events, which means that the behavior can be slightly different
depending on the order of plugin registrations.

Instead, we now use the null transport to avoid this issue.
Fabien Potencier 14 年之前
父节点
当前提交
52697ed3df
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php

+ 4 - 4
src/Symfony/Bundle/SwiftmailerBundle/DependencyInjection/SwiftmailerExtension.php

@@ -60,6 +60,10 @@ class SwiftmailerExtension extends Extension
             $transport = $config['transport'];
         }
 
+        if (isset($config['disable_delivery']) && $config['disable_delivery']) {
+            $transport = 'null';
+        }
+
         if ('smtp' === $transport) {
             $loader->load('smtp.xml');
         }
@@ -117,10 +121,6 @@ class SwiftmailerExtension extends Extension
         } else {
             $container->setParameter('swiftmailer.single_address', null);
         }
-
-        if (isset($config['disable_delivery']) && $config['disable_delivery']) {
-            $container->getDefinition('swiftmailer.plugin.blackhole')->addTag('swiftmailer.plugin');
-        }
     }
 
     /**