Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

30 lines
872B

  1. <?php
  2. namespace common\logic\Opinion\Service;
  3. use common\logic\AbstractManager;
  4. use common\logic\User\User\Model\User;
  5. use common\logic\User\User\Service\UserSolver;
  6. class OpinionManager extends AbstractManager
  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. }