From 2e2bd83a25fcb28349e7c0f5330011112dea19e7 Mon Sep 17 00:00:00 2001 From: "Thomas A. Hirsch" Date: Tue, 7 Feb 2023 16:14:17 +0100 Subject: [PATCH] Adapt to Swiftmailer 5 and Swiftmailer 6 version of class Swift_ConfigurableSpool --- .../lib/mailer/Swift_DoctrineSpool.class.php | 8 +++---- .../lib/mailer/Swift_DoctrineSpoolAdapter.php | 21 +++++++++++++++++++ .../lib/mailer/Swift_DoctrineSpoolBase.php | 6 ++++++ 3 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 lib/plugins/sfDoctrinePlugin/lib/mailer/Swift_DoctrineSpoolAdapter.php create mode 100644 lib/plugins/sfDoctrinePlugin/lib/mailer/Swift_DoctrineSpoolBase.php diff --git a/lib/plugins/sfDoctrinePlugin/lib/mailer/Swift_DoctrineSpool.class.php b/lib/plugins/sfDoctrinePlugin/lib/mailer/Swift_DoctrineSpool.class.php index 01a520ec6..02edcb562 100644 --- a/lib/plugins/sfDoctrinePlugin/lib/mailer/Swift_DoctrineSpool.class.php +++ b/lib/plugins/sfDoctrinePlugin/lib/mailer/Swift_DoctrineSpool.class.php @@ -23,7 +23,7 @@ * @author Fabien Potencier * @version SVN: $Id$ */ -class Swift_DoctrineSpool extends Swift_ConfigurableSpool +class Swift_DoctrineSpool extends Swift_DoctrineSpoolAdapter { protected $model = null, @@ -71,9 +71,9 @@ public function stop() /** * Stores a message in the queue. * - * @param Swift_Mime_Message $message The message to store + * @param $message The message to store */ - public function queueMessage(Swift_Mime_Message $message) + public function internalQueueMessage($message) { $object = new $this->model; @@ -84,7 +84,7 @@ public function queueMessage(Swift_Mime_Message $message) $object->{$this->column} = serialize($message); $object->save(); - + $object->free(true); } diff --git a/lib/plugins/sfDoctrinePlugin/lib/mailer/Swift_DoctrineSpoolAdapter.php b/lib/plugins/sfDoctrinePlugin/lib/mailer/Swift_DoctrineSpoolAdapter.php new file mode 100644 index 000000000..ad0a8a850 --- /dev/null +++ b/lib/plugins/sfDoctrinePlugin/lib/mailer/Swift_DoctrineSpoolAdapter.php @@ -0,0 +1,21 @@ += 0) { + abstract class Swift_DoctrineSpoolAdapter extends Swift_DoctrineSpoolBase + { + public function queueMessage(Swift_Mime_SimpleMessage $message) + { + $this->internalQueueMessage($message); + } + } +} else { + abstract class Swift_DoctrineSpoolAdapter extends Swift_DoctrineSpoolBase + { + public function queueMessage(Swift_Mime_Message $message) + { + $this->internalQueueMessage($message); + } + } +} diff --git a/lib/plugins/sfDoctrinePlugin/lib/mailer/Swift_DoctrineSpoolBase.php b/lib/plugins/sfDoctrinePlugin/lib/mailer/Swift_DoctrineSpoolBase.php new file mode 100644 index 000000000..2258fc8f2 --- /dev/null +++ b/lib/plugins/sfDoctrinePlugin/lib/mailer/Swift_DoctrineSpoolBase.php @@ -0,0 +1,6 @@ +