Conditions | 2 |
Paths | 2 |
Total Lines | 22 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
95 | public function handle($email) |
||
96 | { |
||
97 | if (!$this->validate()) { |
||
98 | return false; |
||
99 | } |
||
100 | |||
101 | $products = Product::find()->where(['in', 'id', array_keys($this->quantity)])->select(['id', 'alias', 'title', 'price'])->all(); |
||
102 | |||
103 | return Yii::$app->mailer->compose('order', [ |
||
104 | 'header' => Yii::t('order', 'New client'), |
||
105 | 'name' => $this->name, |
||
106 | 'email' => $this->email, |
||
107 | 'phone' => $this->phone, |
||
108 | 'comment' => $this->comment, |
||
109 | 'counts' => $this->quantity, |
||
110 | 'products' => $products, |
||
111 | 'baseUrl' => Yii::$app->homeUrl |
||
112 | ]) |
||
113 | ->setTo($email) |
||
114 | ->setFrom([$this->email => $this->name]) |
||
115 | ->setSubject(Yii::t('order', 'New order in {project_name} site.', ['project_name' => Yii::$app->params['project_name']])) |
||
116 | ->send(); |
||
117 | } |
||
119 |