|
|
@@ -3,8 +3,11 @@ |
|
|
|
namespace Lc\CaracoleBundle\Twig; |
|
|
|
|
|
|
|
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryQuery; |
|
|
|
use Lc\CaracoleBundle\Repository\Reminder\ReminderStore; |
|
|
|
use Lc\CaracoleBundle\Repository\Section\SectionRepository; |
|
|
|
use Lc\CaracoleBundle\Repository\Section\SectionRepositoryInterface; |
|
|
|
use Lc\CaracoleBundle\Resolver\MerchantResolver; |
|
|
|
use Lc\CaracoleBundle\Resolver\SectionResolver; |
|
|
|
use Twig\Extension\AbstractExtension; |
|
|
|
use Twig\TwigFunction; |
|
|
|
|
|
|
@@ -12,13 +15,22 @@ class StoreTwigExtension extends AbstractExtension |
|
|
|
{ |
|
|
|
protected $merchantRepository; |
|
|
|
protected $sectionRepository; |
|
|
|
protected ReminderStore $reminderStore; |
|
|
|
protected MerchantResolver $merchantResolver; |
|
|
|
protected SectionResolver $sectionResolver; |
|
|
|
|
|
|
|
public function __construct( |
|
|
|
MerchantResolver $merchantResolver, |
|
|
|
SectionResolver $sectionResolver, |
|
|
|
MerchantRepositoryQuery $merchantRepository, |
|
|
|
SectionRepository $sectionRepository |
|
|
|
SectionRepository $sectionRepository, |
|
|
|
ReminderStore $reminderStore |
|
|
|
) { |
|
|
|
$this->merchantResolver = $merchantResolver; |
|
|
|
$this->sectionResolver = $sectionResolver; |
|
|
|
$this->merchantRepository = $merchantRepository; |
|
|
|
$this->sectionRepository = $sectionRepository; |
|
|
|
$this->reminderStore = $reminderStore; |
|
|
|
} |
|
|
|
|
|
|
|
public function getFunctions() |
|
|
@@ -26,6 +38,7 @@ class StoreTwigExtension extends AbstractExtension |
|
|
|
return array( |
|
|
|
new TwigFunction('carac_sections', [$this, 'getSections']), |
|
|
|
new TwigFunction('carac_merchants', [$this, 'getMerchants']), |
|
|
|
new TwigFunction('carac_reminders', [$this, 'getReminders']), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
@@ -39,4 +52,11 @@ class StoreTwigExtension extends AbstractExtension |
|
|
|
return $this->merchantRepository->findAll(); |
|
|
|
} |
|
|
|
|
|
|
|
public function getReminders($params = []) |
|
|
|
{ |
|
|
|
$params['merchant'] = $this->merchantResolver->getCurrent(); |
|
|
|
$params['section'] = $this->sectionResolver->getCurrent(); |
|
|
|
return $this->reminderStore->get($params); |
|
|
|
} |
|
|
|
|
|
|
|
} |