[SwiftmailerBundle] made data collector configurable via the logging option
This commit is contained in:
parent
95532cc1de
commit
8c6f135534
@ -65,7 +65,9 @@ class Configuration
|
||||
->scalarNode('path')->defaultValue('%kernel.cache_dir%/swiftmailer/spool')->end()
|
||||
->end()
|
||||
->scalarNode('delivery_address')->end()
|
||||
->booleanNode('disable_delivery')->end();
|
||||
->booleanNode('disable_delivery')->end()
|
||||
->booleanNode('logging')->defaultValue(false)->end()
|
||||
;
|
||||
|
||||
return $treeBuilder->buildTree();
|
||||
}
|
||||
|
@ -93,7 +93,10 @@ class SwiftmailerExtension extends Extension
|
||||
}
|
||||
}
|
||||
|
||||
if ($config['logging']) {
|
||||
$container->findDefinition('swiftmailer.transport')->addMethodCall('registerPlugin', array(new Reference('swiftmailer.plugin.messagelogger')));
|
||||
$container->findDefinition('data_collector.swiftmailer')->addTag('data_collector', array('template' => 'SwiftmailerBundle:Collector:swiftmailer', 'id' => 'swiftmailer'));
|
||||
}
|
||||
|
||||
if (isset($config['delivery_address']) && $config['delivery_address']) {
|
||||
$container->setParameter('swiftmailer.single_address', $config['delivery_address']);
|
||||
|
@ -22,6 +22,7 @@
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="delivery-address" type="xsd:string" />
|
||||
<xsd:attribute name="disable-delivery" type="xsd:boolean" />
|
||||
<xsd:attribute name="logging" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
|
||||
<xsd:complexType name="spool">
|
||||
|
@ -68,8 +68,7 @@
|
||||
|
||||
<service id="swiftmailer.plugin.messagelogger" class="%swiftmailer.plugin.messagelogger.class%" public="false" />
|
||||
|
||||
<service id="swiftmailer.data_collector" class="%swiftmailer.data_collector.class%" public="false">
|
||||
<tag name="data_collector" template="SwiftmailerBundle:Collector:message" id="swiftmailer" />
|
||||
<service id="data_collector.swiftmailer" class="%swiftmailer.data_collector.class%" public="false">
|
||||
<argument type="service" id="swiftmailer.plugin.messagelogger" />
|
||||
<argument type="service" id="swiftmailer.mailer" />
|
||||
</service>
|
||||
|
Reference in New Issue
Block a user