您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

70 行
1.8KB

  1. <?php
  2. namespace domain\User\User;
  3. use domain\Producer\Producer\Producer;
  4. use domain\Ticket\Ticket\Ticket;
  5. use domain\_\AbstractNotifier;
  6. use domain\_\ManagerInterface;
  7. class UserNotifier extends AbstractNotifier implements ManagerInterface
  8. {
  9. protected UserSolver $userSolver;
  10. public function loadDependencies(): void
  11. {
  12. parent::loadDependencies();
  13. $this->userSolver = $this->loadService(UserSolver::class);
  14. }
  15. public function sendEmailSignup(User $user, Producer $producer)
  16. {
  17. $this->mailer->sendFromSite(
  18. 'Inscription',
  19. 'signup',
  20. [
  21. 'user' => $user,
  22. 'producer' => $producer
  23. ],
  24. $user->email
  25. );
  26. }
  27. /**
  28. * Envoie un email de bienvenue à l'utilisateur lors de son inscription
  29. * via le backend du site.
  30. */
  31. public function sendMailWelcome(User $user, string $password): void
  32. {
  33. if (strlen($user->email)) {
  34. $producer = $this->getProducerContext();
  35. $this->mailer->sendFromProducer(
  36. 'Inscription',
  37. 'createUserAdmin',
  38. [
  39. 'user' => $user,
  40. 'producer' => $producer,
  41. 'password' => $password
  42. ],
  43. $user->email,
  44. $producer
  45. );
  46. }
  47. }
  48. public function sendMailNewPassword(User $user, string $password)
  49. {
  50. $producer = $this->getProducerContext();
  51. \Yii::$app->mailerService->sendFromProducer(
  52. 'Nouveau mot de passe',
  53. 'newPasswordUserAdmin',
  54. [
  55. 'user' => $user,
  56. 'producer' => $producer,
  57. 'password' => $password,
  58. ],
  59. $user->email,
  60. $producer
  61. );
  62. }
  63. }