Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 7 mēnešiem
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace domain\Payment;
  3. use domain\User\User\User;
  4. use domain\User\User\UserRepository;
  5. use domain\_\AbstractNotifier;
  6. class PaymentNotifier extends AbstractNotifier
  7. {
  8. protected UserRepository $userRepository;
  9. public function loadDependencies(): void
  10. {
  11. parent::loadDependencies();
  12. $this->userRepository = $this->loadService(UserRepository::class);
  13. }
  14. public function notifyUserCreditMovement(User $user, string $type, float $amount)
  15. {
  16. if($user->email) {
  17. $producer = $this->getProducerContext();
  18. $credit = $this->userRepository->getCredit($user, true);
  19. $this->mailer->sendFromProducer(
  20. 'Mouvement de cagnotte',
  21. 'creditUser',
  22. [
  23. 'user' => $user,
  24. 'producer' => $producer,
  25. 'credit' => $credit,
  26. 'type' => $type,
  27. 'amount' => $amount
  28. ],
  29. $user->email,
  30. $producer
  31. );
  32. return true;
  33. }
  34. return false;
  35. }
  36. }