소스 검색

Merge branch 'develop' of https://forge.laclic.fr/Laclic/CaracoleBundle into develop

packProduct
Charly 3 년 전
부모
커밋
17b4cfe898
21개의 변경된 파일376개의 추가작업 그리고 52개의 파일을 삭제
  1. +3
    -0
      Builder/Order/OrderShopBuilder.php
  2. +4
    -2
      Builder/Product/ProductFamilySectionPropertyBuilder.php
  3. +31
    -33
      Builder/Setting/SettingBuilder.php
  4. +34
    -0
      Command/MerchantSettingInitCommand.php
  5. +34
    -0
      Command/SectionSettingInitCommand.php
  6. +15
    -0
      Controller/ControllerTrait.php
  7. +2
    -3
      Controller/Merchant/SwitchMerchantController.php
  8. +2
    -1
      Controller/User/UserAdminController.php
  9. +1
    -0
      Definition/Field/Product/ProductCategoryFieldDefinition.php
  10. +9
    -3
      Definition/Field/User/UserMerchantFieldDefinition.php
  11. +54
    -0
      EventSubscriber/Product/UpdateProductFamilySectionPropertyEventSubscriber.php
  12. +38
    -0
      Field/Filter/User/UserMerchantEmailFilter.php
  13. +38
    -0
      Field/Filter/User/UserMerchantFirstnameFilter.php
  14. +41
    -0
      Field/Filter/User/UserMerchantLastnameFilter.php
  15. +1
    -1
      Repository/File/DocumentRepositoryQuery.php
  16. +1
    -5
      Repository/File/DocumentStore.php
  17. +2
    -1
      Repository/Product/ProductFamilyRepositoryQuery.php
  18. +2
    -1
      Repository/StoreTrait.php
  19. +43
    -2
      Repository/User/UserMerchantRepositoryQuery.php
  20. +4
    -0
      Resolver/SectionResolver.php
  21. +17
    -0
      Solver/Config/UnitSolver.php

+ 3
- 0
Builder/Order/OrderShopBuilder.php 파일 보기

@@ -339,6 +339,9 @@ class OrderShopBuilder
OrderShopInterface $orderShop2,
$persist = true
): OrderShopInterface {
//TODO essayer de comprendre prk on doit faire un refresh ici ???
$this->entityManager->refresh($orderShop1);
$this->entityManager->refresh($orderShop2);
if ($orderShop1 && $orderShop2) {
foreach ($orderShop2->getOrderProducts() as $orderProduct) {
$orderProductAlreadyInCart = $this->orderShopSolver->hasOrderProductAlreadyInCart($orderShop1, $orderProduct);

+ 4
- 2
Builder/Product/ProductFamilySectionPropertyBuilder.php 파일 보기

@@ -24,7 +24,7 @@ class ProductFamilySectionPropertyBuilder
$this->productFamilySectionPropertyStore = $productFamilySectionPropertyStore;
}

public function enable(ProductFamilyInterface $productFamily, SectionInterface $section): void
public function enable(ProductFamilyInterface $productFamily, SectionInterface $section, bool $flush = true): void
{
$productFamilySectionProperty = $this->productFamilySectionPropertyStore
->setSection($section)
@@ -41,7 +41,9 @@ class ProductFamilySectionPropertyBuilder
$this->entityManager->create($productFamilySectionProperty);
}

$this->entityManager->flush();
if($flush) {
$this->entityManager->flush();
}
}

}

EventSubscriber/SettingEventSubscriber.php → Builder/Setting/SettingBuilder.php 파일 보기

@@ -1,72 +1,66 @@
<?php

namespace Lc\CaracoleBundle\EventSubscriber;
namespace Lc\CaracoleBundle\Builder\Setting;

use Doctrine\ORM\EntityManagerInterface;
use Lc\CaracoleBundle\Definition\MerchantSettingDefinitionInterface;
use Lc\CaracoleBundle\Definition\MerchantSettingDefinition;
use Lc\CaracoleBundle\Definition\SectionSettingDefinition;
use Lc\CaracoleBundle\Factory\Setting\MerchantSettingFactory;
use Lc\CaracoleBundle\Factory\Setting\SectionSettingFactory;
use Lc\CaracoleBundle\Model\Section\SectionInterface;
use Lc\CaracoleBundle\Repository\Merchant\MerchantStore;
use Lc\CaracoleBundle\Repository\Section\SectionStore;
use Lc\SovBundle\Definition\SiteSettingDefinition;
use Lc\SovBundle\Factory\Setting\SiteSettingFactory;
use Lc\SovBundle\Repository\Site\SiteStore;
use Lc\SovBundle\Solver\Setting\SettingSolver;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\KernelEvents;
use Lc\SovBundle\Builder\Setting\SettingBuilder as SovSettingBuilder;

class SettingEventSubscriber implements EventSubscriberInterface
class SettingBuilder extends SovSettingBuilder
{
protected EntityManagerInterface $entityManager;
protected MerchantSettingDefinitionInterface $merchantSettingDefinition;
protected SectionSettingDefinition $sectionSettingDefinition;
protected MerchantStore $merchantStore;
protected SectionStore $sectionStore;
protected MerchantSettingDefinition $merchantSettingDefinition;
protected MerchantSettingFactory $merchantSettingFactory;
protected SectionSettingDefinition $sectionSettingDefinition;
protected SectionSettingFactory $sectionSettingFactory;
protected SettingSolver $settingSolver;

public function __construct(
EntityManagerInterface $entityManager,
MerchantSettingDefinitionInterface $merchantSettingDefinition,
SectionSettingDefinition $sectionSettingDefinition,
SettingSolver $settingSolver,
SiteStore $siteStore,
SiteSettingDefinition $siteSettingDefinition,
SiteSettingFactory $siteSettingFactory,
MerchantStore $merchantStore,
SectionStore $sectionStore,
MerchantSettingDefinition $merchantSettingDefinition,
MerchantSettingFactory $merchantSettingFactory,
SectionSettingFactory $sectionSettingFactory,
SettingSolver $settingSolver
SectionSettingDefinition $sectionSettingDefinition,
SectionSettingFactory $sectionSettingFactory
) {
$this->entityManager = $entityManager;
parent::__construct($entityManager, $settingSolver, $siteStore, $siteSettingDefinition, $siteSettingFactory);

$this->merchantStore = $merchantStore;
$this->sectionStore = $sectionStore;
$this->merchantSettingDefinition = $merchantSettingDefinition;
$this->sectionSettingDefinition = $sectionSettingDefinition;
$this->merchantSettingFactory = $merchantSettingFactory;
$this->sectionSettingDefinition = $sectionSettingDefinition;
$this->sectionSettingFactory = $sectionSettingFactory;
$this->settingSolver = $settingSolver;
}

public static function getSubscribedEvents()
{
return [
KernelEvents::CONTROLLER => ['initSettings']
];
}

public function initSettings()
public function initMerchantSettings()
{
$merchants = $this->merchantStore->get();

$this->initSettingsGeneric(
'merchant',
$this->merchantSettingDefinition->getSettings(),
//TODO vérifier que ce soit bien les online que l'on souhaite
$merchants,
$this->merchantSettingFactory
);
}

public function initSectionSettings()
{
$merchants = $this->merchantStore->get();

foreach($merchants as $merchant) {
$this->initSettingsGeneric(
'section',
$this->sectionSettingDefinition->getSettings(),
$merchant->getSections(),
$this->sectionSettingFactory
@@ -74,16 +68,20 @@ class SettingEventSubscriber implements EventSubscriberInterface
}
}

public function initSettingsGeneric($type, $settings, $entities, $factory)
protected function initSettingsGeneric($settings, $entities, $factory)
{
if($entities) {
foreach ($entities as $entity) {

$this->entityManager->refresh($entity);

foreach ($settings as $category => $settingList) {
foreach ($settingList as $settingName => $setting) {

$entitySetting = $this->settingSolver->getSetting($entity, $settingName);

if (!$entitySetting) {

// gestion du cas des SectionSetting spécifiques à une section
$createEntitySetting = true;
if ($entity instanceof SectionInterface && isset($setting['section']) && $setting['section'] != $entity) {
@@ -107,7 +105,7 @@ class SettingEventSubscriber implements EventSubscriberInterface

$entitySetting = $factory->create($entity, $setting['name'], $text, $date, $file);

$this->entityManager->persist($entitySetting);
$this->entityManager->create($entitySetting);
}
} else {
if ($this->settingSolver->getValue($entitySetting) === null

+ 34
- 0
Command/MerchantSettingInitCommand.php 파일 보기

@@ -0,0 +1,34 @@
<?php

namespace Lc\CaracoleBundle\Command;

use Lc\SovBundle\Builder\Setting\SettingBuilder;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

class MerchantSettingInitCommand extends Command
{
protected static $defaultName = 'setting:merchant:init';
protected static $defaultDescription = 'Initialise les MerchantSetting.';

protected SettingBuilder $settingBuilder;

public function __construct(string $name = null, SettingBuilder $settingBuilder)
{
parent::__construct($name);
$this->settingBuilder = $settingBuilder;
}

/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->io = new SymfonyStyle($input, $output);
$this->settingBuilder->initMerchantSettings();
$this->io->success('Les MerchantSetting ont bien été initialisées.');
return Command::SUCCESS;
}
}

+ 34
- 0
Command/SectionSettingInitCommand.php 파일 보기

@@ -0,0 +1,34 @@
<?php

namespace Lc\CaracoleBundle\Command;

use Lc\SovBundle\Builder\Setting\SettingBuilder;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;

class SectionSettingInitCommand extends Command
{
protected static $defaultName = 'setting:section:init';
protected static $defaultDescription = 'Initialise les SectionSetting.';

protected SettingBuilder $settingBuilder;

public function __construct(string $name = null, SettingBuilder $settingBuilder)
{
parent::__construct($name);
$this->settingBuilder = $settingBuilder;
}

/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->io = new SymfonyStyle($input, $output);
$this->settingBuilder->initSectionSettings();
$this->io->success('Les SectionSetting ont bien été initialisées.');
return Command::SUCCESS;
}
}

+ 15
- 0
Controller/ControllerTrait.php 파일 보기

@@ -159,6 +159,11 @@ trait ControllerTrait
return $this->get(SectionResolver::class)->getCurrent(true);
}

public function getSectionCurrentVisited(): ?SectionInterface
{
return $this->get(SectionResolver::class)->getCurrent(false, true);
}

public function isOutOfSection()
{
return $this->get(SectionResolver::class)->isOutOfSection();
@@ -179,6 +184,16 @@ trait ControllerTrait
);
}

public function getCartCurrentVisited(): OrderShopInterface
{
return $this->getOrderShopContainer()->getBuilder()->createIfNotExist(
$this->getSectionCurrentVisited(),
$this->getUserCurrent(),
$this->getVisitorCurrent(),
true
);
}

public function getPriceSolver(): PriceSolver
{
return $this->get(PriceSolver::class);

+ 2
- 3
Controller/Merchant/SwitchMerchantController.php 파일 보기

@@ -3,10 +3,9 @@
namespace Lc\CaracoleBundle\Controller\Merchant;

use Lc\CaracoleBundle\Container\Merchant\MerchantContainer;
use Lc\CaracoleBundle\Controller\AbstractController;
use Lc\CaracoleBundle\Definition\MerchantSettingDefinition;
use Lc\CaracoleBundle\Form\Merchant\SwitchMerchantFormType;
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

@@ -25,7 +24,7 @@ class SwitchMerchantController extends AbstractController
$context = $form->get('context')->getData();

if ($merchant) {
$url = $this->get(MerchantContainer::class)->getSettingSolver()->getSettingValue(
$url = $this->getSettingValue(
$merchant,
MerchantSettingDefinition::SETTING_URL
);

+ 2
- 1
Controller/User/UserAdminController.php 파일 보기

@@ -31,7 +31,8 @@ abstract class UserAdminController extends SovUserAdminController
foreach ($entity->getActions() as $action){
if($action->getName() == ActionDefinition::SWITCH_USER){
$sectionDefault = $this->getSectionContainer()->getStore()->setMerchant($this->getMerchantCurrent())->getOneDefault();
$url = $this->generateUrl($this->getParameter('lc_sov.homepage_route'), array('_switch_user' => $entity->getInstance()->getEmail(), 'section'=> $sectionDefault));
dump($sectionDefault);
$url = $this->generateUrl($this->getParameter('lc_sov.homepage_route'), array('_switch_user' => $entity->getInstance()->getEmail(), 'section'=> $sectionDefault->getSlug()));
$action->setLinkUrl($url);
}
}

+ 1
- 0
Definition/Field/Product/ProductCategoryFieldDefinition.php 파일 보기

@@ -36,6 +36,7 @@ class ProductCategoryFieldDefinition extends AbstractFieldDefinition
'title',
'position',
'createdAt',
'updatedAt',
'status',
'saleStatus',
'isEligibleTicketRestaurant'

+ 9
- 3
Definition/Field/User/UserMerchantFieldDefinition.php 파일 보기

@@ -7,6 +7,9 @@ use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Context\MerchantContextTrait;
use Lc\CaracoleBundle\Field\AssociationField;
use Lc\CaracoleBundle\Field\Filter\User\UserMerchantEmailFilter;
use Lc\CaracoleBundle\Field\Filter\User\UserMerchantFirstnameFilter;
use Lc\CaracoleBundle\Field\Filter\User\UserMerchantLastnameFilter;
use Lc\SovBundle\Definition\Field\AbstractFieldDefinition;


@@ -38,9 +41,12 @@ class UserMerchantFieldDefinition extends AbstractFieldDefinition

return [
'id'=> IntegerField::new('id')->onlyOnIndex()->setSortable(true),
'lastname'=> TextField::new('user.lastname')->setSortable(true),
'firstname'=> TextField::new('user.firstname')->setSortable(true),
'email'=> TextField::new('user.email')->setSortable(true),
'lastname'=> TextField::new('user.lastname')->setSortable(true)
->setCustomOption('filter_fqcn', UserMerchantLastnameFilter::class),
'firstname'=> TextField::new('user.firstname')->setSortable(true)
->setCustomOption('filter_fqcn', UserMerchantFirstnameFilter::class),
'email'=> TextField::new('user.email')->setSortable(true)
->setCustomOption('filter_fqcn', UserMerchantEmailFilter::class),
'credit'=> NumberField::new('credit')->setSortable(true)
->setTemplatePath('@LcSov/adminlte/crud/field/amount.html.twig')
->setCustomOption('appendHtml', '&euro;'),

+ 54
- 0
EventSubscriber/Product/UpdateProductFamilySectionPropertyEventSubscriber.php 파일 보기

@@ -0,0 +1,54 @@
<?php

namespace Lc\CaracoleBundle\EventSubscriber\Product;

use Doctrine\ORM\EntityManagerInterface;

use Lc\CaracoleBundle\Model\Product\ProductFamilySectionPropertyInterface;
use Lc\SovBundle\Event\EntityManager\EntityManagerEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class UpdateProductFamilySectionPropertyEventSubscriber implements EventSubscriberInterface
{
protected EntityManagerInterface $entityManager;

public function __construct(EntityManagerInterface $entityManager)
{
$this->entityManager = $entityManager;
}

public static function getSubscribedEvents()
{
return [
EntityManagerEvent::PRE_CREATE_EVENT => ['processBeforePersistProductFamilySectionInterface'],
EntityManagerEvent::PRE_UPDATE_EVENT => ['processBeforePersistProductFamilySectionInterface'],
];
}

public function processBeforePersistProductFamilySectionInterface(EntityManagerEvent $event)
{
$productFamilySectionProperty = $event->getEntity();

if($productFamilySectionProperty instanceof ProductFamilySectionPropertyInterface) {
$section = $productFamilySectionProperty->getSection();
if($productFamilySectionProperty->getStatus() == 1) {
$productCategoryArray = $productFamilySectionProperty->getProductFamily()->getProductCategories();
foreach($productCategoryArray as $productCategory) {
if($productCategory->getSection() == $section) {
// mise à jour du statut
$productCategory->setStatus(1);
$this->entityManager->update($productCategory);

// mise à jour du statut du parent
$productCategoryParent = $productCategory->getParent();
if($productCategoryParent) {
$productCategoryParent->setStatus(1);
$this->entityManager->update($productCategoryParent);
}
}
}
}
}
}

}

+ 38
- 0
Field/Filter/User/UserMerchantEmailFilter.php 파일 보기

@@ -0,0 +1,38 @@
<?php

namespace Lc\CaracoleBundle\Field\Filter\User;

use EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto;
use Lc\SovBundle\Field\Filter\AssociationFilter;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;

/**
* @author La clic ! <contact@laclic.fr>
*/
class UserMerchantEmailFilter extends AssociationFilter
{
public function buildProperty(FormBuilderInterface $builder, FieldDto $fieldDto, $options = array())
{
$builder->add(
$this->getFieldPropertySnake($fieldDto->getProperty()),
TextType::class,
array(
'required' => false,
'attr' => array(
'class' => ' input-sm',
'form' => 'filters-form',
),
)
);
}

public function applyFilter(RepositoryQueryInterface $repositoryQuery, FieldDto $fieldDto, $filteredValue = null)
{
if ($filteredValue !== null) {
$repositoryQuery->filterByEmail('%'.$filteredValue.'%');
}
}

}

+ 38
- 0
Field/Filter/User/UserMerchantFirstnameFilter.php 파일 보기

@@ -0,0 +1,38 @@
<?php

namespace Lc\CaracoleBundle\Field\Filter\User;

use EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto;
use Lc\SovBundle\Field\Filter\AssociationFilter;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;

/**
* @author La clic ! <contact@laclic.fr>
*/
class UserMerchantFirstnameFilter extends AssociationFilter
{
public function buildProperty(FormBuilderInterface $builder, FieldDto $fieldDto, $options = array())
{
$builder->add(
$this->getFieldPropertySnake($fieldDto->getProperty()),
TextType::class,
array(
'required' => false,
'attr' => array(
'class' => ' input-sm',
'form' => 'filters-form',
),
)
);
}

public function applyFilter(RepositoryQueryInterface $repositoryQuery, FieldDto $fieldDto, $filteredValue = null)
{
if ($filteredValue !== null) {
$repositoryQuery->filterByFirstname('%'.$filteredValue.'%');
}
}

}

+ 41
- 0
Field/Filter/User/UserMerchantLastnameFilter.php 파일 보기

@@ -0,0 +1,41 @@
<?php

namespace Lc\CaracoleBundle\Field\Filter\User;

use EasyCorp\Bundle\EasyAdminBundle\Dto\FieldDto;
use Lc\SovBundle\Field\Filter\AssociationFilter;
use Lc\SovBundle\Field\Filter\FilterTrait;
use Lc\SovBundle\Repository\RepositoryQueryInterface;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;

/**
* @author La clic ! <contact@laclic.fr>
*/
class UserMerchantLastnameFilter
{
use FilterTrait;
public function buildProperty(FormBuilderInterface $builder, FieldDto $fieldDto, $options = array())
{

$builder->add(
$this->getFieldPropertySnake($fieldDto->getProperty()),
TextType::class,
array(
'required' => false,
'attr' => array(
'class' => ' input-sm',
'form' => 'filters-form',
),
)
);
}

public function applyFilter(RepositoryQueryInterface $repositoryQuery, FieldDto $fieldDto, $filteredValue = null)
{
if ($filteredValue !== null) {
$repositoryQuery->filterByLastname('%'.$filteredValue.'%');
}
}

}

+ 1
- 1
Repository/File/DocumentRepositoryQuery.php 파일 보기

@@ -10,7 +10,7 @@ use Lc\SovBundle\Repository\AbstractRepositoryQuery;

class DocumentRepositoryQuery extends AbstractRepositoryQuery
{
use SectionRepositoryQueryTrait;
use MerchantRepositoryQueryTrait;

public function __construct(DocumentRepository $repository, PaginatorInterface $paginator)
{

+ 1
- 5
Repository/File/DocumentStore.php 파일 보기

@@ -11,7 +11,6 @@ use Lc\SovBundle\Repository\RepositoryQueryInterface;

class DocumentStore extends AbstractStore
{
use SectionStoreTrait;
use MerchantStoreTrait;

protected DocumentRepositoryQuery $query;
@@ -31,12 +30,9 @@ class DocumentStore extends AbstractStore
{
$query->filterIsOnlineAndOffline();

if(isset($this->section) && $this->section) {
$query->filterBySection($this->section);
}

if(isset($this->merchant) && $this->merchant) {
$query->filterByMerchantViaSection($this->merchant);
$query->filterByMerchant($this->merchant);
}

return $query;

+ 2
- 1
Repository/Product/ProductFamilyRepositoryQuery.php 파일 보기

@@ -29,7 +29,8 @@ class ProductFamilyRepositoryQuery extends AbstractRepositoryQuery

$this->leftJoin('.productFamilySectionProperties', 'productFamilySectionProperties');
if ($addSelect) {
$this->addSelect('productFamilySectionProperties');
//NB : Ici le select est en commentaire car si il est actif doctrine n'hydrate pas correectement ProductFamilySectionProperties (si filtre sur section les ProductFamilySectionProperties des autres sections ne sont pas chargé et ça peut être problématique pr la gestion des stocks)
//$this->addSelect('productFamilySectionProperties');
}
}
return $this;

+ 2
- 1
Repository/StoreTrait.php 파일 보기

@@ -4,7 +4,7 @@ namespace Lc\CaracoleBundle\Repository;

trait StoreTrait
{
public function resetContext(): void
public function resetContext(): self
{
if(method_exists($this, 'setMerchant')) {
$this->setMerchant(null);
@@ -13,5 +13,6 @@ trait StoreTrait
if(method_exists($this, 'setSection')) {
$this->setSection(null);
}
return $this;
}
}

+ 43
- 2
Repository/User/UserMerchantRepositoryQuery.php 파일 보기

@@ -11,6 +11,9 @@ class UserMerchantRepositoryQuery extends AbstractRepositoryQuery
{
use MerchantRepositoryQueryTrait;

protected $isJoinUser = false;


public function __construct(UserMerchantRepository $repository, PaginatorInterface $paginator)
{
parent::__construct($repository, 'userMerchant', $paginator);
@@ -19,8 +22,46 @@ class UserMerchantRepositoryQuery extends AbstractRepositoryQuery
public function filterByUser(UserInterface $user)
{
return $this
->andWhere('.user = :user')
->setParameter('user', $user);
->andWhere('.user = :user')
->setParameter('user', $user);
}

public function joinUser(): self
{
if (!$this->isJoinUser) {
$this->isJoinUser = true;

return $this
->leftJoin('.user', 'user');
}
return $this;
}

public function filterByFirstname(string $firstname)
{
$this->joinUser();

return $this
->andWhere('user.firstname LIKE :firstname')
->setParameter('firstname', $firstname);
}

public function filterByLastname(string $lastname)
{
$this->joinUser();

return $this
->andWhere('user.lastname LIKE :lastname')
->setParameter('lastname', $lastname);
}

public function filterByEmail(string $email)
{
$this->joinUser();

return $this
->andWhere('user.email LIKE :email')
->setParameter('email', $email);
}

public function filterIsCreditActive()

+ 4
- 0
Resolver/SectionResolver.php 파일 보기

@@ -11,6 +11,7 @@ use Lc\CaracoleBundle\Repository\Section\SectionRepository;
use Lc\CaracoleBundle\Repository\Section\SectionStore;
use Lc\SovBundle\Resolver\UrlResolver;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Security;

class SectionResolver
@@ -94,6 +95,9 @@ class SectionResolver
$sectionCurrent = $sectionStore
->setMerchant($merchantCurrent)
->getOneBySlug($requestAttributesArray['section']);
if($sectionCurrent===null){
throw new NotFoundHttpException('Aucun espace n\'a été trouvé');
}
}

if ($sectionCurrent) {

+ 17
- 0
Solver/Config/UnitSolver.php 파일 보기

@@ -0,0 +1,17 @@
<?php

namespace Lc\CaracoleBundle\Solver\Config;



use Lc\CaracoleBundle\Model\Config\UnitInterface;

class UnitSolver
{

public function getWeight(UnitInterface $unit, int $quantityProduct, int $quantity){
return ($quantityProduct / $unit->getCoefficient()) * $quantity;
}


}

Loading…
취소
저장