merchantResolver = $merchantResolver; $this->sectionResolver = $sectionResolver; $this->merchantStore = $merchantStore; $this->sectionStore = $sectionStore; $this->reminderStore = $reminderStore; $this->unitStore = $unitStore; $this->taxRateStore = $taxRateStore; $this->productCategoryStore = $productCategoryStore; $this->orderShopStore = $orderShopStore; $this->settingSolver = $settingSolver; } public function getFunctions() { return array( new TwigFunction('carac_sections', [$this, 'getSections']), new TwigFunction('carac_section_current', [$this, 'getSectionCurrent']), new TwigFunction('carac_cart_current', [$this, 'getCartCurrent']), new TwigFunction('carac_merchants', [$this, 'getMerchants']), new TwigFunction('carac_reminders', [$this, 'getReminders']), new TwigFunction('carac_units', [$this, 'getUnits']), new TwigFunction('carac_tax_rates', [$this, 'getTaxRates']), new TwigFunction('carac_reduction_cart_codes', [$this, 'getTaxRates']), new TwigFunction('product_categories', [$this, 'getProductCategories']), new TwigFunction('cart_current', [$this, 'getCartCurrent']), new TwigFunction('merchant_current', [$this, 'getMerchantCurrent']), new TwigFunction('user_merchant_current', [$this, 'getUserMerchantCurrent']), new TwigFunction('section_current', [$this, 'getSectionCurrent']), new TwigFunction('merchant_setting', [$this, 'getMerchantSetting']), new TwigFunction('merchant_setting_current', [$this, 'getMerchantSettingCurrent']), new TwigFunction('section_setting', [$this, 'getSectionSetting']), new TwigFunction('section_setting_current', [$this, 'getSectionSettingCurrent']), ); } public function getSections() { return $this->sectionStore ->setMerchant($this->merchantResolver->getCurrent()) ->getOnline(); } public function getMerchants() { return $this->merchantStore->getOnline(); } public function getSectionCurrent(): SectionInterface { return $this->sectionResolver->getCurrent(); } public function getCartCurrent(): OrderShopInterface { return $this->orderShopStore ->setSection($this->sectionResolver->getCurrent()) ->getOneCartCurrent(); } public function getMerchantCurrent(): MerchantInterface { return $this->merchantResolver->getCurrent(); } public function getUserMerchantCurrent(): UserMerchantInterface { $this->merchantResolver->getUserMerchant(); } public function getMerchantSetting(MerchantInterface $merchant, string $settingName): string { return $this->settingSolver->getSettingValue($merchant, $settingName); } public function getMerchantSettingCurrent(string $settingName): string { return $this->settingSolver->getSettingValue($this->getMerchantCurrent(), $settingName); } public function getSectionSetting(SectionInterface $section, string $settingName): string { return $this->settingSolver->getSettingValue($section, $settingName); } public function getSectionSettingCurrent(string $settingName): string { return $this->settingSolver->getSettingValue($this->getSectionCurrent(), $settingName); } public function getProductCategories() { return $this->productCategoryStore ->setSection($this->sectionResolver->getCurrent()) ->getParent(); } public function getReminders($params = []) { return $this->reminderStore ->setMerchant($this->merchantResolver->getCurrent()) ->setSection($this->sectionResolver->getCurrent()) ->get($params); } public function getUnits() { return $this->unitStore->getAsArray(); } public function getTaxRates() { return $this->taxRateStore->setMerchant($this->merchantResolver->getCurrent())->getAsArray(); } public function getReductionCartCodes() { //TODO mettre à jour une fois les repo fait return array(); } }