@@ -29,16 +29,7 @@ use Lc\SovBundle\Translation\TranslatorAdmin; | |||
abstract class CreditHistoryAdminController extends AbstractAdminController | |||
{ | |||
use AdminControllerTrait; | |||
protected $em; | |||
protected $translatorAdmin; | |||
public function __construct(EntityManagerInterface $entityManager, TranslatorAdmin $translatorAdmin) | |||
{ | |||
$this->em = $entityManager; | |||
$this->translatorAdmin = $translatorAdmin; | |||
} | |||
public function overrideGlobalActions(?ActionCollection $actions): void | |||
{ | |||
parent::overrideGlobalActions($actions); | |||
@@ -91,16 +82,17 @@ abstract class CreditHistoryAdminController extends AbstractAdminController | |||
public function configureFields(string $pageName): iterable | |||
{ | |||
$translatorAdmin = $this->get('translator_admin'); | |||
return [ | |||
IdField::new('id')->hideOnForm(), | |||
ChoiceField::new('type')->setChoices( | |||
array( | |||
$this->translatorAdmin->transField( | |||
$translatorAdmin->transField( | |||
'typeOptions.'.CreditHistoryModel::TYPE_CREDIT, | |||
'CreditHistory' | |||
) => CreditHistoryModel::TYPE_CREDIT, | |||
$this->translatorAdmin->transField( | |||
$translatorAdmin->transField( | |||
'typeOptions.'.CreditHistoryModel::TYPE_DEBIT, | |||
'CreditHistory' | |||
) => CreditHistoryModel::TYPE_DEBIT, | |||
@@ -110,27 +102,27 @@ abstract class CreditHistoryAdminController extends AbstractAdminController | |||
DateField::new('paidAt'), | |||
ChoiceField::new('meanPayment')->setChoices( | |||
array( | |||
$this->translatorAdmin->transField( | |||
$translatorAdmin->transField( | |||
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CASH, | |||
'CreditHistory' | |||
) => CreditHistoryModel::MEAN_PAYMENT_CASH, | |||
$this->translatorAdmin->transField( | |||
$translatorAdmin->transField( | |||
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CHEQUE, | |||
'CreditHistory' | |||
) => CreditHistoryModel::MEAN_PAYMENT_CHEQUE, | |||
$this->translatorAdmin->transField( | |||
$translatorAdmin->transField( | |||
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CREDIT, | |||
'CreditHistory' | |||
) => CreditHistoryModel::MEAN_PAYMENT_CREDIT, | |||
$this->translatorAdmin->transField( | |||
$translatorAdmin->transField( | |||
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CREDIT_CARD, | |||
'CreditHistory' | |||
) => CreditHistoryModel::MEAN_PAYMENT_CREDIT_CARD, | |||
$this->translatorAdmin->transField( | |||
$translatorAdmin->transField( | |||
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_TRANSFER, | |||
'CreditHistory' | |||
) => CreditHistoryModel::MEAN_PAYMENT_TRANSFER, |
@@ -0,0 +1,37 @@ | |||
<?php | |||
namespace Lc\CaracoleBundle\Controller\Product; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | |||
use Lc\CaracoleBundle\Field\Address\AddressField; | |||
use Lc\SovBundle\Controller\AbstractAdminController; | |||
use Lc\SovBundle\Field\BooleanField; | |||
use Lc\SovBundle\Field\CKEditorField; | |||
use Lc\SovBundle\Field\StatusField; | |||
abstract class ProductCategoryAdminController extends AbstractAdminController | |||
{ | |||
use AdminControllerTrait; | |||
public function configureFields(string $pageName): iterable | |||
{ | |||
return array_merge( | |||
[ | |||
FormField::addPanel('general'), | |||
TextField::new('title'), | |||
AssociationField::new('parent'), | |||
CKEditorField::new('description'), | |||
BooleanField::new('saleStatus'), | |||
StatusField::new('status'), | |||
], | |||
$this->getSeoPanel(), | |||
$this->getConfPanel() | |||
); | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
<?php | |||
namespace Lc\CaracoleBundle\Controller\Product; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField; | |||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; | |||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | |||
use Lc\CaracoleBundle\Field\Address\AddressField; | |||
use Lc\SovBundle\Controller\AbstractAdminController; | |||
use Lc\SovBundle\Field\BooleanField; | |||
use Lc\SovBundle\Field\CKEditorField; | |||
use Lc\SovBundle\Field\StatusField; | |||
abstract class ProductFamilyAdminController extends AbstractAdminController | |||
{ | |||
use AdminControllerTrait; | |||
} |
@@ -7,55 +7,57 @@ use Doctrine\ORM\Mapping as ORM; | |||
trait ReductionTrait | |||
{ | |||
/** | |||
* @ORM\Column(type="float", nullable=true) | |||
*/ | |||
protected $value; | |||
/** | |||
* @ORM\Column(type="string", length=20, nullable=true) | |||
*/ | |||
protected $unit; | |||
/** | |||
* @ORM\Column(type="string", length=20, nullable=true) | |||
*/ | |||
protected $behaviorTaxRate; | |||
/** | |||
* @ORM\Column(type="float", nullable=true) | |||
*/ | |||
protected $value; | |||
/** | |||
* @ORM\Column(type="string", length=20, nullable=true) | |||
*/ | |||
protected $unit; | |||
public function getValue(): ?float | |||
{ | |||
return $this->value; | |||
} | |||
/** | |||
* @ORM\Column(type="string", length=20, nullable=true) | |||
*/ | |||
protected $behaviorTaxRate; | |||
public function setValue(?float $value): self | |||
{ | |||
$this->value = $value; | |||
return $this; | |||
} | |||
public function getValue(): ?float | |||
{ | |||
return $this->value; | |||
} | |||
public function getUnit(): ?string | |||
{ | |||
return $this->unit; | |||
} | |||
public function setValue(?float $value): self | |||
{ | |||
$this->value = $value; | |||
public function setUnit(?string $unit): self | |||
{ | |||
$this->unit = $unit; | |||
return $this; | |||
} | |||
return $this; | |||
} | |||
public function getUnit(): ?string | |||
{ | |||
return $this->unit; | |||
} | |||
public function getBehaviorTaxRate(): ?string | |||
{ | |||
return $this->behaviorTaxRate; | |||
} | |||
public function setUnit(?string $unit): self | |||
{ | |||
$this->unit = $unit; | |||
public function setBehaviorTaxRate(?string $behaviorTaxRate): self | |||
{ | |||
$this->behaviorTaxRate = $behaviorTaxRate; | |||
return $this; | |||
} | |||
return $this; | |||
} | |||
public function getBehaviorTaxRate(): ?string | |||
{ | |||
return $this->behaviorTaxRate; | |||
} | |||
public function setBehaviorTaxRate(?string $behaviorTaxRate): self | |||
{ | |||
$this->behaviorTaxRate = $behaviorTaxRate; | |||
return $this; | |||
} | |||
} |
@@ -11,6 +11,18 @@ use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity; | |||
abstract class TaxRateModel extends AbstractLightEntity | |||
{ | |||
const BEHAVIOR_TAX_RATE_INCLUDED = 'tax-included'; | |||
const BEHAVIOR_TAX_RATE_EXCLUDED = 'tax-excluded'; | |||
public function getBehaviorTaxRateChoices(): array | |||
{ | |||
return [ | |||
self::BEHAVIOR_TAX_RATE_EXCLUDED, | |||
self::BEHAVIOR_TAX_RATE_INCLUDED, | |||
]; | |||
} | |||
/** | |||
* @ORM\Column(type="string", length=255) | |||
*/ |
@@ -10,6 +10,19 @@ use Lc\SovBundle\Doctrine\Pattern\AbstractLightEntity; | |||
*/ | |||
abstract class UnitModel extends AbstractLightEntity | |||
{ | |||
const UNIT_PERCENT = 'percent'; | |||
const UNIT_AMOUNT = 'amount'; | |||
public function getUnitAmountChoices(): array | |||
{ | |||
return [ | |||
self::UNIT_PERCENT, | |||
self::UNIT_AMOUNT, | |||
]; | |||
} | |||
/** | |||
* @ORM\Column(type="string", length=32) | |||
*/ |
@@ -6,6 +6,7 @@ use Doctrine\Common\Collections\ArrayCollection; | |||
use Doctrine\Common\Collections\Collection; | |||
use Doctrine\ORM\Mapping as ORM; | |||
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | |||
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface; | |||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||
use Lc\SovBundle\Doctrine\Extension\TreeInterface; | |||
@@ -14,7 +15,7 @@ use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity; | |||
/** | |||
* @ORM\MappedSuperclass() | |||
*/ | |||
abstract class ProductCategoryModel extends AbstractFullEntity implements TreeInterface, FilterMerchantInterface | |||
abstract class ProductCategoryModel extends AbstractFullEntity implements TreeInterface, FilterMerchantInterface, FilterSectionInterface | |||
{ | |||
/** | |||
@@ -23,6 +24,12 @@ abstract class ProductCategoryModel extends AbstractFullEntity implements TreeIn | |||
*/ | |||
protected $merchant; | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface") | |||
* @ORM\JoinColumn(nullable=false) | |||
*/ | |||
protected $section; | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Product\ProductCategoryInterface", inversedBy="childrens") | |||
*/ | |||
@@ -45,12 +52,6 @@ abstract class ProductCategoryModel extends AbstractFullEntity implements TreeIn | |||
protected $saleStatus; | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface", inversedBy="productCategories") | |||
* @ORM\JoinColumn(nullable=false) | |||
*/ | |||
protected $section; | |||
public function __construct() | |||
{ | |||
$this->childrens = new ArrayCollection(); | |||
@@ -65,6 +66,32 @@ abstract class ProductCategoryModel extends AbstractFullEntity implements TreeIn | |||
return $title; | |||
} | |||
public function getMerchant(): MerchantInterface | |||
{ | |||
return $this->merchant; | |||
} | |||
public function setMerchant(MerchantInterface $merchant): self | |||
{ | |||
$this->merchant = $merchant; | |||
return $this; | |||
} | |||
public function getSection(): SectionInterface | |||
{ | |||
return $this->section; | |||
} | |||
public function setSection(SectionInterface $section): self | |||
{ | |||
$this->section = $section; | |||
return $this; | |||
} | |||
public function getParent(): ?self | |||
{ | |||
return $this->parent; | |||
@@ -165,18 +192,6 @@ abstract class ProductCategoryModel extends AbstractFullEntity implements TreeIn | |||
return $count; | |||
} | |||
public function getMerchant(): ?MerchantInterface | |||
{ | |||
return $this->merchant; | |||
} | |||
public function setMerchant(?MerchantInterface $merchant): self | |||
{ | |||
$this->merchant = $merchant; | |||
return $this; | |||
} | |||
public function getSaleStatus(): ?bool | |||
{ | |||
return $this->saleStatus; | |||
@@ -189,16 +204,4 @@ abstract class ProductCategoryModel extends AbstractFullEntity implements TreeIn | |||
return $this; | |||
} | |||
public function getSection(): ?SectionInterface | |||
{ | |||
return $this->section; | |||
} | |||
public function setSection(?SectionInterface $section): self | |||
{ | |||
$this->section = $section; | |||
return $this; | |||
} | |||
} |
@@ -30,38 +30,123 @@ abstract class ProductFamilyModel extends AbstractFullEntity implements ProductP | |||
const BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY = 'by-product-family'; | |||
const BEHAVIOR_COUNT_STOCK_BY_PRODUCT = 'by-product'; | |||
public function getBehaviorCountStockChoices(): array | |||
{ | |||
return [ | |||
self::BEHAVIOR_COUNT_STOCK_BY_MEASURE, | |||
self::BEHAVIOR_COUNT_STOCK_BY_PRODUCT, | |||
self::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY, | |||
self::BEHAVIOR_COUNT_STOCK_UNLIMITED, | |||
]; | |||
} | |||
const BEHAVIOR_DISPLAY_SALE_BY_MEASURE = 'by-measure'; | |||
const BEHAVIOR_DISPLAY_SALE_BY_QUANTITY = 'by-quantity'; | |||
public function getBehaviorDisplaySaleChoices(): array | |||
{ | |||
return [ | |||
self::BEHAVIOR_DISPLAY_SALE_BY_MEASURE, | |||
self::BEHAVIOR_DISPLAY_SALE_BY_QUANTITY, | |||
]; | |||
} | |||
const BEHAVIOR_STOCK_WEEK_RENEWABLE = 'renewable'; | |||
const BEHAVIOR_STOCK_WEEK_RENEWABLE_VALIDATION = 'renewable-with-validation'; | |||
const BEHAVIOR_STOCK_WEEK_NON_RENEWABLE = 'non-renewable'; | |||
public function getBehaviorStockWeekChoices(): array | |||
{ | |||
return [ | |||
self::BEHAVIOR_STOCK_WEEK_NON_RENEWABLE, | |||
self::BEHAVIOR_STOCK_WEEK_RENEWABLE, | |||
self::BEHAVIOR_STOCK_WEEK_RENEWABLE_VALIDATION, | |||
]; | |||
} | |||
const WARNING_MESSAGE_TYPE_SUCCESS = 'success'; | |||
const WARNING_MESSAGE_TYPE_ERROR = 'error'; | |||
const WARNING_MESSAGE_TYPE_WARNING = 'warning'; | |||
const WARNING_MESSAGE_TYPE_INFO = 'info'; | |||
public function getWaringMessageTypeChoices(): array | |||
{ | |||
return [ | |||
self::WARNING_MESSAGE_TYPE_ERROR, | |||
self::WARNING_MESSAGE_TYPE_INFO, | |||
self::WARNING_MESSAGE_TYPE_SUCCESS, | |||
self::WARNING_MESSAGE_TYPE_WARNING, | |||
]; | |||
} | |||
const BEHAVIOR_ADD_TO_CART_SIMPLE = 'simple'; | |||
const BEHAVIOR_ADD_TO_CART_MULTIPLE = 'multiple'; | |||
public function getBehaviorAddToCartChoices(): array | |||
{ | |||
return [ | |||
self::BEHAVIOR_ADD_TO_CART_MULTIPLE, | |||
self::BEHAVIOR_ADD_TO_CART_SIMPLE, | |||
]; | |||
} | |||
const BEHAVIOR_PRICE_BY_PIECE = 'by-piece'; | |||
const BEHAVIOR_PRICE_BY_REFERENCE_UNIT = 'by-reference-unit'; | |||
public function getBehaviorPriceChoices(): array | |||
{ | |||
return [ | |||
self::BEHAVIOR_PRICE_BY_PIECE, | |||
self::BEHAVIOR_PRICE_BY_REFERENCE_UNIT, | |||
]; | |||
} | |||
const PROPERTY_ORGANIC_LABEL_AB = 'ab'; | |||
const PROPERTY_ORGANIC_LABEL_NP = 'nature-progres'; | |||
const PROPERTY_ORGANIC_LABEL_HVE = 'hve'; | |||
const PROPERTY_ORGANIC_LABEL_TRVR = 'trvr'; | |||
public function getPropertyOrganicLabelChoices(): array | |||
{ | |||
return [ | |||
self::PROPERTY_ORGANIC_LABEL_AB, | |||
self::PROPERTY_ORGANIC_LABEL_NP, | |||
self::PROPERTY_ORGANIC_LABEL_HVE, | |||
self::PROPERTY_ORGANIC_LABEL_TRVR, | |||
]; | |||
} | |||
const TYPE_EXPIRATION_DATE_DLC = 'dlc'; | |||
const TYPE_EXPIRATION_DATE_DDM = 'ddm'; | |||
const TYPE_EXPIRATION_DATE_DLUO = 'dluo'; | |||
public function getTypeExpirationDateChoices(): array | |||
{ | |||
return [ | |||
self::TYPE_EXPIRATION_DATE_DLC, | |||
self::TYPE_EXPIRATION_DATE_DDM, | |||
self::TYPE_EXPIRATION_DATE_DLUO, | |||
]; | |||
} | |||
const BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY = 'by-product-family'; | |||
const BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT = 'by-product'; | |||
public function getBehaviorExpirationDateChoices():array{ | |||
return [ | |||
self::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT_FAMILY, | |||
self::BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT | |||
]; | |||
} | |||
//Champ hydraté par ProductFamilyUtils | |||
protected $reductionCatalog; | |||
/** | |||
* @Gedmo\Blameable(on="create") | |||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") |
@@ -2,12 +2,33 @@ | |||
namespace Lc\CaracoleBundle\Repository\Config; | |||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | |||
class TaxRateStore | |||
{ | |||
protected TaxRateRepositoryQuery $query; | |||
protected MerchantResolver $merchantResolver; | |||
public function __construct(TaxRateRepositoryQuery $query) | |||
public function __construct(TaxRateRepositoryQuery $query, MerchantResolver $merchantResolver) | |||
{ | |||
$this->query = $query; | |||
$this->merchantResolver = $merchantResolver; | |||
} | |||
public function getAsArray() | |||
{ | |||
$query = $this->query->create(); | |||
$taxRatesList = array(); | |||
foreach ($query->find() as $taxRate) { | |||
$taxRatesList[$taxRate->getId()]['title'] = $taxRate->getTitle(); | |||
$taxRatesList[$taxRate->getId()]['value'] = $taxRate->getValue(); | |||
} | |||
$taxRatesList['default']['title'] = $this->merchantResolver->getCurrent()->getTaxRate()->getTitle(); | |||
$taxRatesList['default']['value'] = $this->merchantResolver->getCurrent()->getTaxRate()->getValue(); | |||
return $taxRatesList; | |||
} | |||
} |
@@ -10,4 +10,20 @@ class UnitStore | |||
{ | |||
$this->query = $query; | |||
} | |||
public function getAsArray(){ | |||
$query = $this->query->create(); | |||
foreach ($query->find() as $unit) { | |||
$unitsList[$unit->getId()]['unit'] = $unit->getUnit(); | |||
$unitsList[$unit->getId()]['wordingUnit'] = $unit->getWordingUnit(); | |||
$unitsList[$unit->getId()]['wording'] = $unit->getWording(); | |||
$unitsList[$unit->getId()]['wordingShort'] = $unit->getWordingShort(); | |||
$unitsList[$unit->getId()]['coefficient'] = $unit->getCoefficient(); | |||
$unitsList[$unit->getId()]['unitReference'] = $unit->getUnitReference()->getId(); | |||
} | |||
return $unitsList; | |||
} | |||
} |
@@ -3,6 +3,7 @@ | |||
namespace Lc\CaracoleBundle\Repository\Reduction; | |||
use Knp\Component\Pager\PaginatorInterface; | |||
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | |||
use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait; | |||
use Lc\SovBundle\Repository\AbstractRepositoryQuery; | |||
@@ -14,4 +15,18 @@ class ReductionCatalogRepositoryQuery extends AbstractRepositoryQuery | |||
{ | |||
parent::__construct($repository, 'r', $paginator); | |||
} | |||
public function filterProductFamily(ProductFamilyInterface $productFamily) | |||
{ | |||
return $this | |||
->andWhere('.productFamily = :productFamily') | |||
->setParameter(':productFamily', $productFamily); | |||
} | |||
public function filterStatus(bool $status) | |||
{ | |||
return $this | |||
->andWhere('.status = :status') | |||
->setParameter(':status', $status); | |||
} | |||
} |
@@ -10,4 +10,12 @@ class ReductionCatalogStore | |||
{ | |||
$this->query = $query; | |||
} | |||
public function getByProductFamily($productFamily){ | |||
$query = $this->query->create(); | |||
$query->filterProductFamily($productFamily); | |||
$query->filterStatus(true); | |||
return $query->findOne(); | |||
} | |||
} |
@@ -1,6 +1,7 @@ | |||
menu: | |||
pointsale: Points de vente | |||
product_category: Catégories | |||
setting: Paramètres | |||
setting_merchant: Marchand | |||
setting_section: Section | |||
@@ -40,6 +41,9 @@ entity: | |||
panels: | |||
address: Adresse | |||
fields: | |||
parent: Parent | |||
saleStatus: En vente | |||
subtitle: Sous-titre | |||
address: Adresse | |||
merchant: Marchand | |||
taxRate: Règle de taxe | |||
@@ -123,6 +127,9 @@ entity: | |||
fields: | |||
timeStart: Heure d'ouverture | |||
timeEnd: Heure de fermeture | |||
ProductCategory: | |||
label: Catégorie | |||
label_plurial: Catégories | |||
form: | |||
user_merchant: |
@@ -2,6 +2,8 @@ | |||
namespace Lc\CaracoleBundle\Twig; | |||
use Lc\CaracoleBundle\Repository\Config\TaxRateStore; | |||
use Lc\CaracoleBundle\Repository\Config\UnitStore; | |||
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryQuery; | |||
use Lc\CaracoleBundle\Repository\Reminder\ReminderStore; | |||
use Lc\CaracoleBundle\Repository\Section\SectionRepository; | |||
@@ -9,6 +11,7 @@ use Lc\CaracoleBundle\Repository\Section\SectionRepositoryInterface; | |||
use Lc\CaracoleBundle\Repository\Section\SectionRepositoryQuery; | |||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | |||
use Lc\CaracoleBundle\Resolver\SectionResolver; | |||
use Lc\ShopBundle\Context\UnitInterface; | |||
use Twig\Extension\AbstractExtension; | |||
use Twig\TwigFunction; | |||
@@ -19,19 +22,25 @@ class StoreTwigExtension extends AbstractExtension | |||
protected ReminderStore $reminderStore; | |||
protected MerchantResolver $merchantResolver; | |||
protected SectionResolver $sectionResolver; | |||
protected UnitStore $unitStore; | |||
protected TaxRateStore $taxRateStore; | |||
public function __construct( | |||
MerchantResolver $merchantResolver, | |||
SectionResolver $sectionResolver, | |||
MerchantRepositoryQuery $merchantRepositoryQuery, | |||
SectionRepositoryQuery $sectionRepositoryQuery, | |||
ReminderStore $reminderStore | |||
ReminderStore $reminderStore, | |||
UnitStore $unitStore, | |||
TaxRateStore $taxRateStore | |||
) { | |||
$this->merchantResolver = $merchantResolver; | |||
$this->sectionResolver = $sectionResolver; | |||
$this->merchantRepositoryQuery = $merchantRepositoryQuery; | |||
$this->sectionRepositoryQuery = $sectionRepositoryQuery; | |||
$this->reminderStore = $reminderStore; | |||
$this->unitStore = $unitStore; | |||
$this->taxRateStore = $taxRateStore; | |||
} | |||
public function getFunctions() | |||
@@ -40,6 +49,8 @@ class StoreTwigExtension extends AbstractExtension | |||
new TwigFunction('carac_sections', [$this, 'getSections']), | |||
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']), | |||
); | |||
} | |||
@@ -63,4 +74,14 @@ class StoreTwigExtension extends AbstractExtension | |||
->get($params); | |||
} | |||
public function getUnits(){ | |||
return $this->unitStore->getAsArray(); | |||
} | |||
public function getTaxRates(){ | |||
return $this->taxRateStore->getAsArray(); | |||
} | |||
} |