To be more specific:
Looking at https://github.com/yiisoft/yii2/blob/master/framework/mail/BaseMailer.php#L140
use yii\web\View;
[...]
protected function createView(array $config)
{
if (!array_key_exists('class', $config)) {
$config['class'] = View::className();
}
return Yii::createObject($config);
}
What is the real reason for doing so ?
I would have expected to use same view component i defined in the configuration, which is something extending \yii\web\View which could easily be retrieved from
Yii::$app->view::className()
which is anyway the default one and would cause the exact behaviors for people not extending the base view class.
P.S:
I know i can use BaseMailer::setView() and BaseMailer::setViewPath() but why should i duplicate my code when i already have set these details in my configuration for the view component ?
Thanks.