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.

41 lines
881B

  1. <?php
  2. namespace Lc\SovBundle\Twig;
  3. use Lc\SovBundle\Repository\Reminder\ReminderStore;
  4. use Symfony\Component\Security\Core\Security;
  5. use Twig\Extension\AbstractExtension;
  6. use Twig\TwigFunction;
  7. class StoreTwigExtension extends AbstractExtension
  8. {
  9. protected Security $security;
  10. protected ReminderStore $reminderStore;
  11. public function __construct(
  12. Security $security,
  13. ReminderStore $reminderStore
  14. ) {
  15. $this->security = $security;
  16. $this->reminderStore = $reminderStore;
  17. }
  18. public function getFunctions()
  19. {
  20. return [
  21. new TwigFunction('sov_get_reminders', [$this, 'getReminders']),
  22. ];
  23. }
  24. public function getFilters()
  25. {
  26. return [];
  27. }
  28. public function getReminders()
  29. {
  30. return $this->reminderStore->getByUser($this->security->getUser());
  31. }
  32. }