You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace common\logic\Opinion\Service;
  3. use common\logic\AbstractUtils;
  4. use common\logic\User\User\Model\User;
  5. use common\logic\User\User\Service\UserSolver;
  6. class OpinionUtils extends AbstractUtils
  7. {
  8. protected UserSolver $userSolver;
  9. public function loadDependencies(): void
  10. {
  11. $this->userSolver = $this->loadService(UserSolver::class);
  12. }
  13. public function sendOpinionEmailAdmin($opinionFormModel, User $userCurrent = null)
  14. {
  15. \Yii::$app->mailerService->sendAdmin(
  16. 'Nouvel avis',
  17. 'newOpinionAdmin',
  18. [
  19. 'username' => $userCurrent ? $this->userSolver->getUsername($userCurrent) : $opinionFormModel->name,
  20. 'message' => $opinionFormModel->message,
  21. ],
  22. $userCurrent ? $userCurrent->email : $opinionFormModel->email
  23. );
  24. }
  25. }