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.

46 rindas
1.0KB

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