Fixes #4071: mail component renamed to mailer, yii\log\EmailTarget::$mail renamed to yii\log\EmailTarget::$mailer

This commit is contained in:
Alexander Makarov
2014-06-26 18:28:28 +04:00
parent 9f3e716932
commit 2457e24795
23 changed files with 51 additions and 47 deletions

View File

@@ -144,6 +144,7 @@ Yii Framework 2 Change Log
- Chg #3897: Raised visibility of `yii\web\View::registerAssetFiles()` to protected (samdark)
- Chg #3899: Moved `MailEvent` class to `yii\mail` namespace (cebe)
- Chg #3956: Flash messages set via `Yii::$app->session->setFlash()` will be removed only if they are accessed (qiangxue)
- Chg #4071: `mail` component renamed to `mailer`, `yii\log\EmailTarget::$mail` renamed to `yii\log\EmailTarget::$mailer` (samdark)
- Chg: Replaced `clearAll()` and `clearAllAssignments()` in `yii\rbac\ManagerInterface` with `removeAll()`, `removeAllRoles()`, `removeAllPermissions()`, `removeAllRules()` and `removeAllAssignments()` (qiangxue)
- Chg: Added `$user` as the first parameter of `yii\rbac\Rule::execute()` (qiangxue)
- Chg: `yii\grid\DataColumn::getDataCellValue()` visibility is now `public` to allow accessing the value from a GridView directly (cebe)

View File

@@ -69,3 +69,6 @@ Upgrade from Yii 2.0 Beta
* If you are developing RESTful APIs and using an authentication method such as `yii\filters\auth\HttpBasicAuth`,
you should explicitly configure `yii\web\User::enableSession` in the application configuration to be false to avoid
starting a session when authentication is performed. Previously this was done automatically by authentication method.
* `mail` component was renamed to `mailer`, `yii\log\EmailTarget::$mail` was renamed to `yii\log\EmailTarget::$mailer`.
Please update all references in the code and config files.

View File

@@ -24,7 +24,7 @@ use yii\mail\MailerInterface;
* 'targets' => [
* [
* 'class' => 'yii\log\EmailTarget',
* 'mail' =>'mail',
* 'mailer' =>'mailer',
* 'levels' => ['error', 'warning'],
* 'message' => [
* 'from' => ['log@example.com'],
@@ -37,7 +37,7 @@ use yii\mail\MailerInterface;
* ],
* ```
*
* In the above `mail` is ID of the component that sends email and should be already configured.
* In the above `mailer` is ID of the component that sends email and should be already configured.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
@@ -54,7 +54,7 @@ class EmailTarget extends Target
* After the EmailTarget object is created, if you want to change this property, you should only assign it
* with a mailer object.
*/
public $mail = 'mail';
public $mailer = 'mailer';
/**
@@ -66,7 +66,7 @@ class EmailTarget extends Target
if (empty($this->message['to'])) {
throw new InvalidConfigException('The "to" option must be set for EmailTarget::message.');
}
$this->mail = Instance::ensure($this->mail, 'yii\mail\MailerInterface');
$this->mailer = Instance::ensure($this->mailer, 'yii\mail\MailerInterface');
}
/**
@@ -81,7 +81,7 @@ class EmailTarget extends Target
}
$messages = array_map([$this, 'formatMessage'], $this->messages);
$body = wordwrap(implode("\n", $messages), 70);
$this->composeMessage($body)->send($this->mail);
$this->composeMessage($body)->send($this->mailer);
}
/**
@@ -91,7 +91,7 @@ class EmailTarget extends Target
*/
protected function composeMessage($body)
{
$message = $this->mail->compose();
$message = $this->mailer->compose();
Yii::configure($message, $this->message);
$message->setTextBody($body);

View File

@@ -14,7 +14,7 @@ namespace yii\mail;
* also support composition of the message body through the view rendering mechanism. For example,
*
* ~~~
* Yii::$app->mail->compose('contact/html', ['contactForm' => $form])
* Yii::$app->mailer->compose('contact/html', ['contactForm' => $form])
* ->setFrom('from@domain.com')
* ->setTo($form->email)
* ->setSubject($form->subject)

View File

@@ -16,7 +16,7 @@ namespace yii\mail;
* Messages are sent by a [[\yii\mail\MailerInterface|mailer]], like the following,
*
* ~~~
* Yii::$app->mail->compose()
* Yii::$app->mailer->compose()
* ->setFrom('from@domain.com')
* ->setTo($form->email)
* ->setSubject($form->subject)