Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt to Swiftmailer 5 and Swiftmailer 6 version of class Swift_ConfigurableSpool #279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
* @version SVN: $Id$
*/
class Swift_DoctrineSpool extends Swift_ConfigurableSpool
class Swift_DoctrineSpool extends Swift_DoctrineSpoolAdapter
{
protected
$model = null,
Expand Down Expand Up @@ -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)
protected function internalQueueMessage($message)
{
$object = new $this->model;

Expand All @@ -84,7 +84,7 @@ public function queueMessage(Swift_Mime_Message $message)

$object->{$this->column} = serialize($message);
$object->save();

$object->free(true);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

// Defining a base class for Swift_DoctrineSpool to handle both, Swiftmailer 5 and Swiftmailer 6,
// as we are implementing a base class from the package, we can't simply remove the type hint.
if(class_exists('Swift') && version_compare(Swift::VERSION, '6.0.0') >= 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);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

abstract class Swift_DoctrineSpoolBase extends Swift_ConfigurableSpool
{
protected abstract function internalQueueMessage($message);
}