Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

43 lines
1.1KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Twig;
  3. use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryQuery;
  4. use Lc\CaracoleBundle\Repository\Section\SectionRepository;
  5. use Lc\CaracoleBundle\Repository\Section\SectionRepositoryInterface;
  6. use Twig\Extension\AbstractExtension;
  7. use Twig\TwigFunction;
  8. class StoreTwigExtension extends AbstractExtension
  9. {
  10. protected $merchantRepository;
  11. protected $sectionRepository;
  12. public function __construct(
  13. MerchantRepositoryQuery $merchantRepository,
  14. SectionRepository $sectionRepository
  15. ) {
  16. $this->merchantRepository = $merchantRepository;
  17. $this->sectionRepository = $sectionRepository;
  18. }
  19. public function getFunctions()
  20. {
  21. return array(
  22. new TwigFunction('carac_sections', [$this, 'getSections']),
  23. new TwigFunction('carac_merchants', [$this, 'getMerchants']),
  24. );
  25. }
  26. public function getSections()
  27. {
  28. return $this->sectionRepository->findAll();
  29. }
  30. public function getMerchants()
  31. {
  32. return $this->merchantRepository->findAll();
  33. }
  34. }