diff --git a/UPDATE.md b/UPDATE.md
index 19e963f3c4..95d976d82e 100644
--- a/UPDATE.md
+++ b/UPDATE.md
@@ -18,6 +18,22 @@ RC4 to RC5
* `channel`: to register it only for one logging channel (exclusive with `handler`)
* `method`: The method used to process the record (`__invoke` is used if not set)
+ * The email_prototype for the `SwiftMailerHandler` only accept a service id now.
+
+ * Before:
+
+ email_prototype: @acme_demo.monolog.email_prototype
+
+ * After:
+
+ email_prototype: acme_demo.monolog.email_prototype
+
+ or if you want to use a factory for the prototype:
+
+ email_prototype:
+ id: acme_demo.monolog.email_prototype
+ method: getPrototype
+
* To avoid security issues, HTTP headers coming from proxies are not trusted
anymore by default (like `HTTP_X_FORWARDED_FOR`, `X_FORWARDED_PROTO`, and
`X_FORWARDED_HOST`). If your application is behind a reverse proxy, add the
diff --git a/src/Symfony/Bundle/MonologBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/MonologBundle/DependencyInjection/Configuration.php
index 619824c8ee..633fac9203 100644
--- a/src/Symfony/Bundle/MonologBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/MonologBundle/DependencyInjection/Configuration.php
@@ -73,7 +73,17 @@ class Configuration implements ConfigurationInterface
->scalarNode('from_email')->end() // swift_mailer and native_mailer
->scalarNode('to_email')->end() // swift_mailer and native_mailer
->scalarNode('subject')->end() // swift_mailer and native_mailer
- ->scalarNode('email_prototype')->end() // swift_mailer
+ ->arrayNode('email_prototype') // swift_mailer
+ ->canBeUnset()
+ ->beforeNormalization()
+ ->ifString()
+ ->then(function($v) { return array('id' => $v); })
+ ->end()
+ ->children()
+ ->scalarNode('id')->isRequired()->end()
+ ->scalarNode('factory-method')->defaultNull()->end()
+ ->end()
+ ->end()
->scalarNode('formatter')->end()
->end()
->validate()
diff --git a/src/Symfony/Bundle/MonologBundle/DependencyInjection/MonologExtension.php b/src/Symfony/Bundle/MonologBundle/DependencyInjection/MonologExtension.php
index b4c042eb5b..d38e18f134 100644
--- a/src/Symfony/Bundle/MonologBundle/DependencyInjection/MonologExtension.php
+++ b/src/Symfony/Bundle/MonologBundle/DependencyInjection/MonologExtension.php
@@ -186,7 +186,11 @@ class MonologExtension extends Extension
case 'swift_mailer':
if (isset($handler['email_prototype'])) {
- $prototype = $this->parseDefinition($handler['email_prototype']);
+ if (!empty($handler['email_prototype']['method'])) {
+ $prototype = array(new Reference($handler['email_prototype']['id']), $handler['email_prototype']['method']);
+ } else {
+ $prototype = new Reference($handler['email_prototype']['id']);
+ }
} else {
$message = new Definition('Swift_Message');
$message->setFactoryService('mailer');
@@ -243,18 +247,4 @@ class MonologExtension extends Extension
{
return sprintf('monolog.handler.%s', $name);
}
-
- private function parseDefinition($definition, ContainerBuilder $container = null)
- {
- if (0 === strpos($definition, '@')) {
- $definition = substr($definition, 1);
- if ($container && $container->hasDefinition($definition)) {
- $container->getDefinition($definition)->setPublic(true);
- }
-
- return new Reference($definition);
- }
-
- return $definition;
- }
}
diff --git a/src/Symfony/Bundle/MonologBundle/Resources/config/schema/monolog-1.0.xsd b/src/Symfony/Bundle/MonologBundle/Resources/config/schema/monolog-1.0.xsd
index 21705a0539..2cb695d707 100644
--- a/src/Symfony/Bundle/MonologBundle/Resources/config/schema/monolog-1.0.xsd
+++ b/src/Symfony/Bundle/MonologBundle/Resources/config/schema/monolog-1.0.xsd
@@ -10,16 +10,15 @@
-
-
+
-
+
@@ -35,7 +34,6 @@
-
@@ -56,4 +54,9 @@
+
+
+
+
+