|
- <?php
-
- namespace Lc\CaracoleBundle\Twig;
-
- use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryQuery;
- use Lc\CaracoleBundle\Repository\Section\SectionRepository;
- use Lc\CaracoleBundle\Repository\Section\SectionRepositoryInterface;
- use Twig\Extension\AbstractExtension;
- use Twig\TwigFunction;
-
- class StoreTwigExtension extends AbstractExtension
- {
- protected $merchantRepository;
- protected $sectionRepository;
-
- public function __construct(
- MerchantRepositoryQuery $merchantRepository,
- SectionRepository $sectionRepository
- ) {
- $this->merchantRepository = $merchantRepository;
- $this->sectionRepository = $sectionRepository;
- }
-
- public function getFunctions()
- {
- return array(
- new TwigFunction('carac_sections', [$this, 'getSections']),
- new TwigFunction('carac_merchants', [$this, 'getMerchants']),
- );
- }
-
- public function getSections()
- {
- return $this->sectionRepository->findAll();
- }
-
- public function getMerchants()
- {
- return $this->merchantRepository->findAll();
- }
-
- }
|