Skip to content
Permalink
Browse files

Remove usage of deprecated methods in Mailer and Email class.

  • Loading branch information...
dereuromark committed Dec 26, 2016
1 parent c2bd06e commit 5ba2c3a1733a9596263a9dfa8b8afbda28e0bab0
Showing with 10 additions and 8 deletions.
  1. +6 −5 src/Mailer/Email.php
  2. +4 −3 src/Mailer/Mailer.php
@@ -342,7 +342,7 @@ public function __construct($config = null)
$config = static::config('default');
}
if ($config) {
$this->profile($config);
$this->setProfile($config);
}
if (empty($this->headerCharset)) {
$this->headerCharset = $this->charset;
@@ -999,6 +999,7 @@ public function getSubject()
/**
* Get/Set Subject.
*
* @deprecated 3.4.0 Use setSubject()/getSubject() instead.
* @param string|null $subject Subject string.
* @return string|self
*/
@@ -2009,7 +2010,7 @@ public function send($content = null)
$this->_message = $this->_render($this->_wrap($content));
$transport = $this->transport();
$transport = $this->getTransport();
if (!$transport) {
$msg = 'Cannot send email, transport was not defined. Did you call transport() or define ' .
' a transport in the set profile?';
@@ -2070,13 +2071,13 @@ public static function deliver($to = null, $subject = null, $message = null, $tr
/* @var \Cake\Mailer\Email $instance */
$instance = new $class($transportConfig);
if ($to !== null) {
$instance->to($to);
$instance->setTo($to);
}
if ($subject !== null) {
$instance->subject($subject);
$instance->setSubject($subject);
}
if (is_array($message)) {
$instance->viewVars($message);
$instance->setViewVars($message);
$message = null;
} elseif ($message === null && array_key_exists('message', $config = $instance->profile())) {
$message = $config['message'];
@@ -33,8 +33,8 @@
* public function resetPassword($user)
* {
* $this
* ->subject('Reset Password')
* ->to($user->email)
* ->setSubject('Reset Password')
* ->setTo($user->email)
* ->set(['token' => $user->token]);
* }
* }
@@ -173,6 +173,7 @@ public function getName()
/**
* Sets layout to use.
*
* @deprecated 3.4.0 Use setLayout() which sets the layout on the email class instead.
* @param string $layout Name of the layout to use.
* @return self object.
*/
@@ -216,7 +217,7 @@ public function __call($method, $args)
*/
public function set($key, $value = null)
{
$this->_email->viewVars(is_string($key) ? [$key => $value] : $key);
$this->_email->setViewVars(is_string($key) ? [$key => $value] : $key);
return $this;
}

0 comments on commit 5ba2c3a

Please sign in to comment.
You can’t perform that action at this time.