|
- <?php
-
- namespace common\logic\Opinion\Service;
-
- use common\logic\AbstractManager;
- use common\logic\User\User\Model\User;
- use common\logic\User\User\Service\UserSolver;
-
- class OpinionManager extends AbstractManager
- {
- protected UserSolver $userSolver;
-
- public function loadDependencies(): void
- {
- $this->userSolver = $this->loadService(UserSolver::class);
- }
-
- public function sendOpinionEmailAdmin($opinionFormModel, User $userCurrent = null)
- {
- \Yii::$app->mailerService->sendAdmin(
- 'Nouvel avis',
- 'newOpinionAdmin',
- [
- 'username' => $userCurrent ? $this->userSolver->getUsername($userCurrent) : $opinionFormModel->name,
- 'message' => $opinionFormModel->message,
- ],
- $userCurrent ? $userCurrent->email : $opinionFormModel->email
- );
- }
- }
|