Skip to content
Snippets Groups Projects

Issue #3418117: Deprecated function: Creation of dynamic property...

1 file
+ 12
5
Compare changes
  • Side-by-side
  • Inline
@@ -33,6 +33,13 @@ class LogMail extends EmailAdjusterBase implements ContainerFactoryPluginInterfa
*/
protected $symfonyMailLogStorage;
/**
* The log of the e-mail being processed.
*
* @var \Drupal\symfony_mailer_log\Entity\SymfonyMailerLog
*/
protected $log;
/**
* Creates an email adjuster plugin for using Maillog via Symfony Mailer.
*
@@ -86,10 +93,9 @@ class LogMail extends EmailAdjusterBase implements ContainerFactoryPluginInterfa
]);
$log->save();
// Store the log entity on the $email so we can update it later when the
// 'errorMessage' is set (or left unset) after attempting to actually send
// the email.
$email->_symfony_mailer_log = $log;
// Store the log entity on so it can updated later when the 'errorMessage'
// is set (or left unset) after attempting to actually send the email.
$this->log = $log;
}
catch (\Exception $ex) {
$this->getLogger('symfony_mail_log')->error($ex->getMessage());
@@ -103,12 +109,13 @@ class LogMail extends EmailAdjusterBase implements ContainerFactoryPluginInterfa
* The email to process.
*/
public function postSend(EmailInterface $email) {
if ($log = $email->_symfony_mailer_log) {
if ($log = $this->log) {
if ($errorMessage = $email->getError()) {
$log->setErrorMessage(substr($errorMessage, 0, 255));
}
$log->save();
}
$this->log = NULL;
}
/**
Loading