From c0d84b9888498798a9fda95558cdf81dc84faf5f Mon Sep 17 00:00:00 2001 From: Johan DESMYTER Date: Mon, 31 Oct 2016 17:04:23 +0300 Subject: [PATCH 1/3] add warning about the limitation on using swiftmail with file spool and lazy loading --- email/spool.rst | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/email/spool.rst b/email/spool.rst index 51cd2b710a5..fad50d4de16 100644 --- a/email/spool.rst +++ b/email/spool.rst @@ -141,3 +141,16 @@ You can also set the time limit in seconds: Of course you will not want to run this manually in reality. Instead, the console command should be triggered by a cron job or scheduled task and run at a regular interval. + +.. caution:: + + When you use the filesystem for spooling, messages are serialized with + the message class name. If the service is lazy loaded this class name + change on every cache clear. So if you send a mail, then you clear the + cache, the message will not be unserialisable. + + On the next ``swiftmailer:spool:send`` an error will raise because the + class ``Swift_Message_`` doesn't exist (anymore). + + The solutions are either to use the memory spool or to load the + swiftmailer without ``lazy`` option. From 88c5eed0ff92020f2cd75a49c54642421d760eee Mon Sep 17 00:00:00 2001 From: Johan DESMYTER Date: Mon, 31 Oct 2016 21:17:51 +0300 Subject: [PATCH 2/3] more precision on class name, and lazy service --- email/spool.rst | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/email/spool.rst b/email/spool.rst index fad50d4de16..e269d98e184 100644 --- a/email/spool.rst +++ b/email/spool.rst @@ -144,13 +144,18 @@ at a regular interval. .. caution:: - When you use the filesystem for spooling, messages are serialized with - the message class name. If the service is lazy loaded this class name - change on every cache clear. So if you send a mail, then you clear the - cache, the message will not be unserialisable. + When you create a message with swiftmailer, it generate a Swift_Message + class. If the swiftmailer service is lazy loaded, it generate instead a + proxy class named Swift_Message_. + + If you use the memory spool, this change is transparent and has no impart. + But when you use the filesystem spool, the message class is serialized on + a file with the randomized class name. The problem is that this random + class name change on every cache clear. So if you send a mail, then you + clear the cache, the message will not be unserializable. On the next ``swiftmailer:spool:send`` an error will raise because the class ``Swift_Message_`` doesn't exist (anymore). - The solutions are either to use the memory spool or to load the - swiftmailer without ``lazy`` option. + The solutions are either to use the memory spool or to load the + swiftmailer service without ``lazy`` option (see :doc:`/service_container/lazy_services`). From d6082136098f24eadc06cf741daf2c17e5de84de Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 2 Nov 2016 08:52:52 +0100 Subject: [PATCH 3/3] Fixed minor syntax issues and typos --- email/spool.rst | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/email/spool.rst b/email/spool.rst index e269d98e184..7e80bc4fa12 100644 --- a/email/spool.rst +++ b/email/spool.rst @@ -144,18 +144,18 @@ at a regular interval. .. caution:: - When you create a message with swiftmailer, it generate a Swift_Message - class. If the swiftmailer service is lazy loaded, it generate instead a - proxy class named Swift_Message_. + When you create a message with SwiftMailer, it generates a ``Swift_Message`` + class. If the ``swiftmailer`` service is lazy loaded, it generates instead a + proxy class named ``Swift_Message_``. - If you use the memory spool, this change is transparent and has no impart. - But when you use the filesystem spool, the message class is serialized on + If you use the memory spool, this change is transparent and has no impact. + But when using the filesystem spool, the message class is serialized in a file with the randomized class name. The problem is that this random - class name change on every cache clear. So if you send a mail, then you + class name changes on every cache clear. So if you send a mail and then you clear the cache, the message will not be unserializable. - On the next ``swiftmailer:spool:send`` an error will raise because the - class ``Swift_Message_`` doesn't exist (anymore). + On the next execution of ``swiftmailer:spool:send`` an error will raise because + the class ``Swift_Message_`` doesn't exist (anymore). The solutions are either to use the memory spool or to load the - swiftmailer service without ``lazy`` option (see :doc:`/service_container/lazy_services`). + ``swiftmailer`` service without ``lazy`` option (see :doc:`/service_container/lazy_services`).