Browse Source

Intégration app product

packProduct
Fab 3 years ago
parent
commit
a46ee7178a
14 changed files with 342 additions and 89 deletions
  1. +9
    -17
      Controller/Credit/CreditHistoryAdminController.php
  2. +37
    -0
      Controller/Product/ProductCategoryAdminController.php
  3. +21
    -0
      Controller/Product/ProductFamilyAdminController.php
  4. +41
    -39
      Doctrine/Extension/ReductionTrait.php
  5. +12
    -0
      Model/Config/TaxRateModel.php
  6. +13
    -0
      Model/Config/UnitModel.php
  7. +34
    -31
      Model/Product/ProductCategoryModel.php
  8. +85
    -0
      Model/Product/ProductFamilyModel.php
  9. +22
    -1
      Repository/Config/TaxRateStore.php
  10. +16
    -0
      Repository/Config/UnitStore.php
  11. +15
    -0
      Repository/Reduction/ReductionCatalogRepositoryQuery.php
  12. +8
    -0
      Repository/Reduction/ReductionCatalogStore.php
  13. +7
    -0
      Resources/translations/admin.fr.yaml
  14. +22
    -1
      Twig/StoreTwigExtension.php

+ 9
- 17
Controller/Credit/CreditHistoryAdminController.php View File

abstract class CreditHistoryAdminController extends AbstractAdminController abstract class CreditHistoryAdminController extends AbstractAdminController
{ {
use AdminControllerTrait; 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 public function overrideGlobalActions(?ActionCollection $actions): void
{ {
parent::overrideGlobalActions($actions); parent::overrideGlobalActions($actions);


public function configureFields(string $pageName): iterable public function configureFields(string $pageName): iterable
{ {
$translatorAdmin = $this->get('translator_admin');
return [ return [
IdField::new('id')->hideOnForm(), IdField::new('id')->hideOnForm(),
ChoiceField::new('type')->setChoices( ChoiceField::new('type')->setChoices(
array( array(
$this->translatorAdmin->transField(
$translatorAdmin->transField(
'typeOptions.'.CreditHistoryModel::TYPE_CREDIT, 'typeOptions.'.CreditHistoryModel::TYPE_CREDIT,
'CreditHistory' 'CreditHistory'
) => CreditHistoryModel::TYPE_CREDIT, ) => CreditHistoryModel::TYPE_CREDIT,


$this->translatorAdmin->transField(
$translatorAdmin->transField(
'typeOptions.'.CreditHistoryModel::TYPE_DEBIT, 'typeOptions.'.CreditHistoryModel::TYPE_DEBIT,
'CreditHistory' 'CreditHistory'
) => CreditHistoryModel::TYPE_DEBIT, ) => CreditHistoryModel::TYPE_DEBIT,
DateField::new('paidAt'), DateField::new('paidAt'),
ChoiceField::new('meanPayment')->setChoices( ChoiceField::new('meanPayment')->setChoices(
array( array(
$this->translatorAdmin->transField(
$translatorAdmin->transField(
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CASH, 'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CASH,
'CreditHistory' 'CreditHistory'
) => CreditHistoryModel::MEAN_PAYMENT_CASH, ) => CreditHistoryModel::MEAN_PAYMENT_CASH,


$this->translatorAdmin->transField(
$translatorAdmin->transField(
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CHEQUE, 'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CHEQUE,
'CreditHistory' 'CreditHistory'
) => CreditHistoryModel::MEAN_PAYMENT_CHEQUE, ) => CreditHistoryModel::MEAN_PAYMENT_CHEQUE,


$this->translatorAdmin->transField(
$translatorAdmin->transField(
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CREDIT, 'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CREDIT,
'CreditHistory' 'CreditHistory'
) => CreditHistoryModel::MEAN_PAYMENT_CREDIT, ) => CreditHistoryModel::MEAN_PAYMENT_CREDIT,


$this->translatorAdmin->transField(
$translatorAdmin->transField(
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CREDIT_CARD, 'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_CREDIT_CARD,
'CreditHistory' 'CreditHistory'
) => CreditHistoryModel::MEAN_PAYMENT_CREDIT_CARD, ) => CreditHistoryModel::MEAN_PAYMENT_CREDIT_CARD,


$this->translatorAdmin->transField(
$translatorAdmin->transField(
'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_TRANSFER, 'meanPaymentOptions.'.CreditHistoryModel::MEAN_PAYMENT_TRANSFER,
'CreditHistory' 'CreditHistory'
) => CreditHistoryModel::MEAN_PAYMENT_TRANSFER, ) => CreditHistoryModel::MEAN_PAYMENT_TRANSFER,

+ 37
- 0
Controller/Product/ProductCategoryAdminController.php View File

<?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()
);
}

}

+ 21
- 0
Controller/Product/ProductFamilyAdminController.php View File

<?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;


}

+ 41
- 39
Doctrine/Extension/ReductionTrait.php View File

trait ReductionTrait 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;
}
} }

+ 12
- 0
Model/Config/TaxRateModel.php View File

abstract class TaxRateModel extends 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) * @ORM\Column(type="string", length=255)
*/ */

+ 13
- 0
Model/Config/UnitModel.php View File

*/ */
abstract class UnitModel extends 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) * @ORM\Column(type="string", length=32)
*/ */

+ 34
- 31
Model/Product/ProductCategoryModel.php View File

use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface;
use Lc\CaracoleBundle\Doctrine\Extension\FilterSectionInterface;
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
use Lc\CaracoleBundle\Model\Section\SectionInterface; use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\SovBundle\Doctrine\Extension\TreeInterface; use Lc\SovBundle\Doctrine\Extension\TreeInterface;
/** /**
* @ORM\MappedSuperclass() * @ORM\MappedSuperclass()
*/ */
abstract class ProductCategoryModel extends AbstractFullEntity implements TreeInterface, FilterMerchantInterface
abstract class ProductCategoryModel extends AbstractFullEntity implements TreeInterface, FilterMerchantInterface, FilterSectionInterface
{ {


/** /**
*/ */
protected $merchant; 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") * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Product\ProductCategoryInterface", inversedBy="childrens")
*/ */
protected $saleStatus; protected $saleStatus;




/**
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Section\SectionInterface", inversedBy="productCategories")
* @ORM\JoinColumn(nullable=false)
*/
protected $section;

public function __construct() public function __construct()
{ {
$this->childrens = new ArrayCollection(); $this->childrens = new ArrayCollection();
return $title; 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 public function getParent(): ?self
{ {
return $this->parent; return $this->parent;
return $count; return $count;
} }


public function getMerchant(): ?MerchantInterface
{
return $this->merchant;
}

public function setMerchant(?MerchantInterface $merchant): self
{
$this->merchant = $merchant;

return $this;
}

public function getSaleStatus(): ?bool public function getSaleStatus(): ?bool
{ {
return $this->saleStatus; return $this->saleStatus;
return $this; return $this;
} }


public function getSection(): ?SectionInterface
{
return $this->section;
}

public function setSection(?SectionInterface $section): self
{
$this->section = $section;

return $this;
}

} }

+ 85
- 0
Model/Product/ProductFamilyModel.php View File

const BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY = 'by-product-family'; const BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY = 'by-product-family';
const BEHAVIOR_COUNT_STOCK_BY_PRODUCT = 'by-product'; 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_MEASURE = 'by-measure';
const BEHAVIOR_DISPLAY_SALE_BY_QUANTITY = 'by-quantity'; 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 = 'renewable';
const BEHAVIOR_STOCK_WEEK_RENEWABLE_VALIDATION = 'renewable-with-validation'; const BEHAVIOR_STOCK_WEEK_RENEWABLE_VALIDATION = 'renewable-with-validation';
const BEHAVIOR_STOCK_WEEK_NON_RENEWABLE = 'non-renewable'; 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_SUCCESS = 'success';
const WARNING_MESSAGE_TYPE_ERROR = 'error'; const WARNING_MESSAGE_TYPE_ERROR = 'error';
const WARNING_MESSAGE_TYPE_WARNING = 'warning'; const WARNING_MESSAGE_TYPE_WARNING = 'warning';
const WARNING_MESSAGE_TYPE_INFO = 'info'; 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_SIMPLE = 'simple';
const BEHAVIOR_ADD_TO_CART_MULTIPLE = 'multiple'; 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_PIECE = 'by-piece';
const BEHAVIOR_PRICE_BY_REFERENCE_UNIT = 'by-reference-unit'; 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_AB = 'ab';
const PROPERTY_ORGANIC_LABEL_NP = 'nature-progres'; const PROPERTY_ORGANIC_LABEL_NP = 'nature-progres';
const PROPERTY_ORGANIC_LABEL_HVE = 'hve'; 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_DLC = 'dlc';
const TYPE_EXPIRATION_DATE_DDM = 'ddm'; const TYPE_EXPIRATION_DATE_DDM = 'ddm';
const TYPE_EXPIRATION_DATE_DLUO = 'dluo'; 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_FAMILY = 'by-product-family';
const BEHAVIOR_EXPIRATION_DATE_BY_PRODUCT = 'by-product'; 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 //Champ hydraté par ProductFamilyUtils
protected $reductionCatalog; protected $reductionCatalog;



/** /**
* @Gedmo\Blameable(on="create") * @Gedmo\Blameable(on="create")
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface")

+ 22
- 1
Repository/Config/TaxRateStore.php View File



namespace Lc\CaracoleBundle\Repository\Config; namespace Lc\CaracoleBundle\Repository\Config;


use Lc\CaracoleBundle\Resolver\MerchantResolver;

class TaxRateStore class TaxRateStore
{ {
protected TaxRateRepositoryQuery $query; protected TaxRateRepositoryQuery $query;
protected MerchantResolver $merchantResolver;


public function __construct(TaxRateRepositoryQuery $query)
public function __construct(TaxRateRepositoryQuery $query, MerchantResolver $merchantResolver)
{ {
$this->query = $query; $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;
} }
} }

+ 16
- 0
Repository/Config/UnitStore.php View File

{ {
$this->query = $query; $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;

}
} }

+ 15
- 0
Repository/Reduction/ReductionCatalogRepositoryQuery.php View File

namespace Lc\CaracoleBundle\Repository\Reduction; namespace Lc\CaracoleBundle\Repository\Reduction;


use Knp\Component\Pager\PaginatorInterface; use Knp\Component\Pager\PaginatorInterface;
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait; use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait;
use Lc\SovBundle\Repository\AbstractRepositoryQuery; use Lc\SovBundle\Repository\AbstractRepositoryQuery;


{ {
parent::__construct($repository, 'r', $paginator); 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);
}
} }

+ 8
- 0
Repository/Reduction/ReductionCatalogStore.php View File

{ {
$this->query = $query; $this->query = $query;
} }

public function getByProductFamily($productFamily){
$query = $this->query->create();
$query->filterProductFamily($productFamily);
$query->filterStatus(true);
return $query->findOne();

}
} }

+ 7
- 0
Resources/translations/admin.fr.yaml View File



menu: menu:
pointsale: Points de vente pointsale: Points de vente
product_category: Catégories
setting: Paramètres setting: Paramètres
setting_merchant: Marchand setting_merchant: Marchand
setting_section: Section setting_section: Section
panels: panels:
address: Adresse address: Adresse
fields: fields:
parent: Parent
saleStatus: En vente
subtitle: Sous-titre
address: Adresse address: Adresse
merchant: Marchand merchant: Marchand
taxRate: Règle de taxe taxRate: Règle de taxe
fields: fields:
timeStart: Heure d'ouverture timeStart: Heure d'ouverture
timeEnd: Heure de fermeture timeEnd: Heure de fermeture
ProductCategory:
label: Catégorie
label_plurial: Catégories


form: form:
user_merchant: user_merchant:

+ 22
- 1
Twig/StoreTwigExtension.php View File



namespace Lc\CaracoleBundle\Twig; 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\Merchant\MerchantRepositoryQuery;
use Lc\CaracoleBundle\Repository\Reminder\ReminderStore; use Lc\CaracoleBundle\Repository\Reminder\ReminderStore;
use Lc\CaracoleBundle\Repository\Section\SectionRepository; use Lc\CaracoleBundle\Repository\Section\SectionRepository;
use Lc\CaracoleBundle\Repository\Section\SectionRepositoryQuery; use Lc\CaracoleBundle\Repository\Section\SectionRepositoryQuery;
use Lc\CaracoleBundle\Resolver\MerchantResolver; use Lc\CaracoleBundle\Resolver\MerchantResolver;
use Lc\CaracoleBundle\Resolver\SectionResolver; use Lc\CaracoleBundle\Resolver\SectionResolver;
use Lc\ShopBundle\Context\UnitInterface;
use Twig\Extension\AbstractExtension; use Twig\Extension\AbstractExtension;
use Twig\TwigFunction; use Twig\TwigFunction;


protected ReminderStore $reminderStore; protected ReminderStore $reminderStore;
protected MerchantResolver $merchantResolver; protected MerchantResolver $merchantResolver;
protected SectionResolver $sectionResolver; protected SectionResolver $sectionResolver;
protected UnitStore $unitStore;
protected TaxRateStore $taxRateStore;


public function __construct( public function __construct(
MerchantResolver $merchantResolver, MerchantResolver $merchantResolver,
SectionResolver $sectionResolver, SectionResolver $sectionResolver,
MerchantRepositoryQuery $merchantRepositoryQuery, MerchantRepositoryQuery $merchantRepositoryQuery,
SectionRepositoryQuery $sectionRepositoryQuery, SectionRepositoryQuery $sectionRepositoryQuery,
ReminderStore $reminderStore
ReminderStore $reminderStore,
UnitStore $unitStore,
TaxRateStore $taxRateStore
) { ) {
$this->merchantResolver = $merchantResolver; $this->merchantResolver = $merchantResolver;
$this->sectionResolver = $sectionResolver; $this->sectionResolver = $sectionResolver;
$this->merchantRepositoryQuery = $merchantRepositoryQuery; $this->merchantRepositoryQuery = $merchantRepositoryQuery;
$this->sectionRepositoryQuery = $sectionRepositoryQuery; $this->sectionRepositoryQuery = $sectionRepositoryQuery;
$this->reminderStore = $reminderStore; $this->reminderStore = $reminderStore;
$this->unitStore = $unitStore;
$this->taxRateStore = $taxRateStore;
} }


public function getFunctions() public function getFunctions()
new TwigFunction('carac_sections', [$this, 'getSections']), new TwigFunction('carac_sections', [$this, 'getSections']),
new TwigFunction('carac_merchants', [$this, 'getMerchants']), new TwigFunction('carac_merchants', [$this, 'getMerchants']),
new TwigFunction('carac_reminders', [$this, 'getReminders']), new TwigFunction('carac_reminders', [$this, 'getReminders']),
new TwigFunction('carac_units', [$this, 'getUnits']),
new TwigFunction('carac_tax_rates', [$this, 'getTaxRates']),
); );
} }


->get($params); ->get($params);
} }


public function getUnits(){

return $this->unitStore->getAsArray();
}

public function getTaxRates(){

return $this->taxRateStore->getAsArray();
}

} }

Loading…
Cancel
Save