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.

45 lines
1020B

  1. <?php
  2. namespace Lc\SovBundle\Translation;
  3. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  4. /**
  5. * class FlashBag.
  6. *
  7. * @author La clic !!!!
  8. */
  9. class FlashBagTranslator
  10. {
  11. protected SessionInterface $session;
  12. protected TranslatorAdmin $translatorAdmin;
  13. public function __construct(SessionInterface $session, TranslatorAdmin $translatorAdmin)
  14. {
  15. $this->session = $session;
  16. $this->translatorAdmin = $translatorAdmin;
  17. }
  18. /**
  19. * {@inheritdoc}
  20. */
  21. public function add(
  22. string $type,
  23. $translationKeyName,
  24. $translationEntityName = null,
  25. $translationParam = array()
  26. ): void {
  27. $this->session->getFlashBag()->add(
  28. $type,
  29. $this->translatorAdmin->transFlashMessage(
  30. $type,
  31. $translationKeyName,
  32. $translationEntityName,
  33. $translationParam
  34. )
  35. );
  36. }
  37. }