No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

46 líneas
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. }