Quellcode durchsuchen

Gestion Visitor + refactoring GlobalParam, MerchantUtils, TaxRateUtils, UnitUtils

reduction
Guillaume vor 4 Jahren
Ursprung
Commit
c63dca0bea
17 geänderte Dateien mit 229 neuen und 157 gelöschten Zeilen
  1. +13
    -0
      ShopBundle/Context/MerchantUtilsInterface.php
  2. +4
    -6
      ShopBundle/Controller/Admin/AdminController.php
  3. +1
    -1
      ShopBundle/Controller/Admin/NewsController.php
  4. +4
    -4
      ShopBundle/Controller/Frontend/BaseController.php
  5. +3
    -3
      ShopBundle/Controller/Frontend/CartController.php
  6. +7
    -10
      ShopBundle/EventSubscriber/EditEventSubscriber.php
  7. +0
    -2
      ShopBundle/Model/AbstractEntity.php
  8. +7
    -9
      ShopBundle/Repository/BaseRepository.php
  9. +1
    -1
      ShopBundle/Repository/PointSaleRepository.php
  10. +0
    -34
      ShopBundle/Services/GlobalParam.php
  11. +8
    -0
      ShopBundle/Services/MerchantUtils.php
  12. +33
    -0
      ShopBundle/Services/TaxRateUtils.php
  13. +35
    -0
      ShopBundle/Services/UnitUtils.php
  14. +83
    -0
      ShopBundle/Services/UserUtils.php
  15. +16
    -76
      ShopBundle/Services/Utils.php
  16. +9
    -3
      ShopBundle/Twig/BridgeTwigExtension.php
  17. +5
    -8
      ShopBundle/Twig/FrontendTwigExtension.php

+ 13
- 0
ShopBundle/Context/MerchantUtilsInterface.php Datei anzeigen

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

namespace Lc\ShopBundle\Context;

interface MerchantUtilsInterface
{
/**
* Retourne la tva par défaut du merchant courant
*
* @return TaxRateInterface
*/
public function getMerchantCurrentTaxRate();
}

+ 4
- 6
ShopBundle/Controller/Admin/AdminController.php Datei anzeigen

@@ -8,9 +8,8 @@ use EasyCorp\Bundle\EasyAdminBundle\Controller\EasyAdminController;
use EasyCorp\Bundle\EasyAdminBundle\Event\EasyAdminEvents;
use FOS\UserBundle\Model\UserManagerInterface;
use Lc\ShopBundle\Context\FilterMultipleMerchantsInterface;
use Lc\ShopBundle\Context\GlobalParamInterface;
use Lc\ShopBundle\Context\MerchantInterface;
use Lc\ShopBundle\Context\SortableInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\StatusInterface;
use Lc\ShopBundle\Context\TreeInterface;
use Lc\ShopBundle\Form\AbstractEditPositionType;
@@ -19,7 +18,6 @@ use Mailjet\MailjetSwiftMailer\SwiftMailer\MailjetTransport;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\RadioType;
use Symfony\Component\Form\FormEvent;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Security\Core\Security;
@@ -30,17 +28,17 @@ class AdminController extends EasyAdminController
protected $userManager;
protected $em;
protected $utils;
protected $globalParam ;
protected $merchantUtils ;
protected $mailjetTransport ;

public function __construct(Security $security, UserManagerInterface $userManager, EntityManagerInterface $em, Utils $utils,
GlobalParamInterface $globalParam, MailjetTransport $mailjetTransport)
MerchantUtilsInterface $merchantUtils, MailjetTransport $mailjetTransport)
{
$this->security = $security;
$this->userManager = $userManager;
$this->em = $em;
$this->utils = $utils;
$this->globalParam = $globalParam ;
$this->merchantUtils = $merchantUtils ;
$this->mailjetTransport = $mailjetTransport ;
}


+ 1
- 1
ShopBundle/Controller/Admin/NewsController.php Datei anzeigen

@@ -15,7 +15,7 @@ class NewsController extends AdminController
{
$idNews = $this->request->get('id') ;

$newsletter = $this->globalParam->getCurrentMerchant()->getNewsletter() ;
$newsletter = $this->merchantUtils->getMerchantCurrent()->getNewsletter() ;

if($newsletter) {
$users = $this->em->getRepository($this->em->getClassMetadata(UserInterface::class)->getName())->findAllByNewsletter($newsletter) ;

+ 4
- 4
ShopBundle/Controller/Frontend/BaseController.php Datei anzeigen

@@ -3,18 +3,18 @@
namespace Lc\ShopBundle\Controller\Frontend ;

use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\GlobalParamInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class BaseController extends AbstractController
{
protected $em ;
protected $globalParam ;
protected $merchantUtils ;

public function __construct(EntityManagerInterface $em, GlobalParamInterface $globalParam)
public function __construct(EntityManagerInterface $em, MerchantUtilsInterface $merchantUtils)
{
$this->em = $em ;
$this->globalParam = $globalParam ;
$this->merchantUtils = $merchantUtils ;
}

}

+ 3
- 3
ShopBundle/Controller/Frontend/CartController.php Datei anzeigen

@@ -5,7 +5,7 @@ namespace Lc\ShopBundle\Controller\Frontend ;
use App\Form\Frontend\OrderProductsType;
use CKSource\CKFinder\Response\JsonResponse;
use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\GlobalParamInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\ProductFamilyInterface;
use Symfony\Component\HttpFoundation\Request;

@@ -13,9 +13,9 @@ class CartController extends BaseController
{
protected $productFamilyRepository ;

public function __construct(EntityManagerInterface $em, GlobalParamInterface $globalParam)
public function __construct(EntityManagerInterface $em, MerchantUtilsInterface $merchantUtils)
{
parent::__construct($em, $globalParam);
parent::__construct($em, $merchantUtils);
$this->productFamilyRepository = $this->em->getRepository($this->em->getClassMetaData(ProductFamilyInterface::class)->getName()) ;
}


+ 7
- 10
ShopBundle/EventSubscriber/EditEventSubscriber.php Datei anzeigen

@@ -1,27 +1,24 @@
<?php
# src/EventSubscriber/EasyAdminSubscriber.php
namespace Lc\ShopBundle\EventSubscriber;

use Lc\ShopBundle\Context\FilterMerchantInterface;
use Lc\ShopBundle\Context\FilterMultipleMerchantsInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\SortableInterface;
use Lc\ShopBundle\Context\StatusInterface;
use Lc\ShopBundle\Context\TreeInterface;
use Lc\ShopBundle\Services\GlobalParam;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
use Symfony\Component\Security\Core\Security;


class EditEventSubscriber implements EventSubscriberInterface
{
public $globalParam;
public $merchantUtils;

public function __construct(GlobalParam $globalParam)
public function __construct(MerchantUtilsInterface $merchantUtils)
{
$this->globalParam = $globalParam;

$this->merchantUtils = $merchantUtils;
}

public static function getSubscribedEvents()
@@ -88,12 +85,12 @@ class EditEventSubscriber implements EventSubscriberInterface
}

private function setMerchantProperty($entity){
$entity->setMerchant($this->globalParam->getCurrentMerchant());
$entity->setMerchant($this->merchantUtils->getMerchantCurrent());
}

private function setMultipleMerchantProperty($entity){
if ($entity->getMerchants()->isEmpty()) {
$entity->addMerchant($this->globalParam->getCurrentMerchant());
$entity->addMerchant($this->merchantUtils->getMerchantCurrent());
}
}


+ 0
- 2
ShopBundle/Model/AbstractEntity.php Datei anzeigen

@@ -4,9 +4,7 @@ namespace Lc\ShopBundle\Model;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Lc\ShopBundle\Context\GlobalParamInterface;
use Lc\ShopBundle\Context\UserInterface;
use Lc\ShopBundle\Services\Utils;

/**
* @ORM\MappedSuperclass

+ 7
- 9
ShopBundle/Repository/BaseRepository.php Datei anzeigen

@@ -5,22 +5,20 @@ namespace Lc\ShopBundle\Repository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepositoryInterface;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityRepository;
use Lc\ShopBundle\Context\DefaultRepositoryInterface;
use Lc\ShopBundle\Context\FilterMerchantInterface;
use Lc\ShopBundle\Context\GlobalParamInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\StatusInterface;
use Symfony\Component\Security\Core\Security;

class BaseRepository extends EntityRepository implements ServiceEntityRepositoryInterface
{
public $globalParam;
public $merchantUtils;

/**
* @param string $entityClass The class name of the entity this repository manages
*/
public function __construct(EntityManager $entityManager, GlobalParamInterface $globalParam)
public function __construct(EntityManager $entityManager, MerchantUtilsInterface $merchantUtils)
{
$this->globalParam = $globalParam;
$this->merchantUtils = $merchantUtils;
parent::__construct($entityManager, $entityManager->getClassMetadata($this->getInterfaceClass()));
}

@@ -29,7 +27,7 @@ class BaseRepository extends EntityRepository implements ServiceEntityRepository
{
return $this->createQueryBuilder('e')
->where('e.merchant = :currentMerchant')
->setParameter('currentMerchant', $this->globalParam->getCurrentMerchant()->getId()) ;
->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent()->getId()) ;
}

public function findAll()
@@ -48,7 +46,7 @@ class BaseRepository extends EntityRepository implements ServiceEntityRepository
}

if($entity instanceof FilterMerchantInterface){
if (!isset($criteria['merchant'])) $criteria['merchant'] = $this->globalParam->getCurrentMerchant();
if (!isset($criteria['merchant'])) $criteria['merchant'] = $this->merchantUtils->getMerchantCurrent();
if ($criteria['merchant'] === false) unset($criteria['merchant']);
}

@@ -69,7 +67,7 @@ class BaseRepository extends EntityRepository implements ServiceEntityRepository
}

if($entity instanceof FilterMerchantInterface){
if (!isset($criteria['merchant'])) $criteria['merchant'] = $this->globalParam->getCurrentMerchant();
if (!isset($criteria['merchant'])) $criteria['merchant'] = $this->merchantUtils->getMerchantCurrent();
if ($criteria['merchant'] === false) unset($criteria['merchant']);
}


+ 1
- 1
ShopBundle/Repository/PointSaleRepository.php Datei anzeigen

@@ -24,7 +24,7 @@ class PointSaleRepository extends BaseRepository implements DefaultRepositoryInt
return $this->createQueryBuilder('e')
->where(':currentMerchant MEMBER OF e.merchants')
->andWhere('e.isPublic = 1')
->setParameter('currentMerchant', $this->globalParam->getCurrentMerchant())
->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent())
->getQuery()
->getResult() ;
}

+ 0
- 34
ShopBundle/Services/GlobalParam.php Datei anzeigen

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

namespace Lc\ShopBundle\Services;

use App\Repository\HubRepository;
use Lc\ShopBundle\Context\GlobalParamInterface;
use Lc\ShopBundle\Repository\MerchantRepository;
use Symfony\Component\Security\Core\Security;

class GlobalParam
{
protected $security;

public function __construct(Security $security)
{
$this->security = $security ;
}

public function getCurrentMerchant()
{
$user = $this->security->getUser() ;

if($user && $user->getMerchant()) {
return $user->getMerchant() ;
}
else {
return false ;
}
}
public function getCurrentMerchantTaxRate()
{
return $this->getCurrentMerchant()->getTaxRate();
}
}

+ 8
- 0
ShopBundle/Services/MerchantUtils.php Datei anzeigen

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

namespace Lc\ShopBundle\Services ;

class MerchantUtils
{

}

+ 33
- 0
ShopBundle/Services/TaxRateUtils.php Datei anzeigen

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

namespace Lc\ShopBundle\Services ;

use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\TaxRateInterface;

class TaxRateUtils
{
protected $em ;
protected $merchantUtils ;

public function __construct(EntityManagerInterface $em, MerchantUtilsInterface $merchantUtils)
{
$this->em = $em ;
$this->merchantUtils = $merchantUtils ;
}

public function getTaxRatesList()
{
$taxRatesList =array();
$taxRates = $this->em->getRepository(TaxRateInterface::class)->findAll();
foreach ($taxRates as $taxRate){
$taxRatesList[$taxRate->getId()]['title'] = $taxRate->getTitle();
$taxRatesList[$taxRate->getId()]['value'] = $taxRate->getValue();
}

$taxRatesList['default']['title'] = $this->merchantUtils->getMerchantCurrentTaxRate()->getTitle();
$taxRatesList['default']['value'] = $this->merchantUtils->getMerchantCurrentTaxRate()->getValue();
return $taxRatesList;
}
}

+ 35
- 0
ShopBundle/Services/UnitUtils.php Datei anzeigen

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

namespace Lc\ShopBundle\Services ;

use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\UnitInterface;

class UnitUtils
{
protected $em ;
protected $merchantUtils ;

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

public function getUnitsList()
{
$unitsList =array();
$units = $this->em->getRepository(UnitInterface::class)->findAll();
foreach ($units 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;
}
}



+ 83
- 0
ShopBundle/Services/UserUtils.php Datei anzeigen

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

namespace Lc\ShopBundle\Services ;

use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\HttpFoundation\Cookie ;
use Lc\ShopBundle\Context\VisitorInterface;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\HttpFoundation\RequestStack;

class UserUtils
{
protected $parameterBag ;
protected $em ;
protected $utils ;
protected $requestStack ;
protected $visitorRepository ;

public function __construct(ParameterBagInterface $parameterBag, EntityManagerInterface $em, Utils $utils, RequestStack $requestStack)
{
$this->em = $em ;
$this->parameterBag = $parameterBag ;
$this->utils = $utils ;
$this->requestStack = $requestStack ;
$this->visitorRepository = $this->em->getRepository($this->em->getClassMetadata(VisitorInterface::class)->getName()) ;
}

public function getCookieNameVisitor()
{
return $this->parameterBag->get('app.cookie_name_visitor') ;
}

public function cryptCookie($data)
{
return base64_encode($data);
}

public function decryptCookie($data)
{
return base64_decode($data);
}

public function setCookieVisitor($response, $cookie)
{
$response->headers->setCookie(Cookie::create($this->getCookieNameVisitor(), $this->cryptCookie($cookie), 0, '/', $this->utils->getCookieDomain()));
}

public function getVisitor($cookie)
{
return $this->visitorRepository->findOneBy(['cookie' => $cookie]) ;
}

public function getVisitorCurrent()
{
$cookie = $this->requestStack->getCurrentRequest()->cookies->get($this->getCookieNameVisitor()) ;
return $this->getVisitor($cookie) ;
}

public function addVisitor($cookie, $ip)
{
$classVisitor = $this->em->getClassMetadata(VisitorInterface::class)->getName() ;
$visitor = new $classVisitor ;

$visitor->setCookie($cookie) ;
$visitor->setIp($ip) ;
$visitor->setTotalVisit(1) ;
$visitor->setLastAccess(new \DateTime()) ;

$this->em->persist($visitor);
$this->em->flush() ;
}

public function updateVisitor($visitor)
{
$totalVisit = $visitor->getTotalVisit() + 1 ;
$visitor->setTotalVisit($totalVisit) ;
$visitor->setLastAccess(new \DateTime()) ;

$this->em->persist($visitor);
$this->em->flush() ;
}

}

+ 16
- 76
ShopBundle/Services/Utils.php Datei anzeigen

@@ -4,6 +4,7 @@ namespace Lc\ShopBundle\Services;

use Cocur\Slugify\Slugify;
use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\PageInterface;
use Lc\ShopBundle\Context\TaxRateInterface;
use Lc\ShopBundle\Context\UnitInterface;
@@ -11,85 +12,10 @@ use Lc\ShopBundle\Context\UnitInterface;
class Utils
{
protected $em ;
protected $globalParam ;

/*public function getUnitsListFormatedForType()
{
$choices = [] ;
foreach ($this->unitsArray as $unit=>$unitInfo){
$choices[$unitInfo['wording_unit']] = $unit;
};
return $choices;
}

public function getUnitsList()
{
return $this->unitsArray;
}

public function getUnitProperty($unit, $property)
{
$unitsArray = $this->getUnitsList() ;

if(isset($unitsArray[$unit][$property])) {
return $unitsArray[$unit][$property] ;
}

return false ;
}



public function getUnitWording($unit, $type = 'wording_short')
{
return $this->getUnitProperty($unit, $type) ;
}

public function getUnitRef($unit)
{
return $this->getUnitProperty($unit, 'ref') ;
}

public function getUnitCoefficient($unit)
{
return $this->getUnitProperty($unit, 'coefficient') ;
}*/


public function __construct(EntityManagerInterface $em, GlobalParam $globalParam)
public function __construct(EntityManagerInterface $em)
{
$this->em = $em ;
$this->globalParam = $globalParam;
}

public function getUnitsList()
{
$unitsList =array();
$units = $this->em->getRepository(UnitInterface::class)->findAll();
foreach ($units 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;
}

public function getTaxRatesList()
{
$taxRatesList =array();
$taxRates = $this->em->getRepository(TaxRateInterface::class)->findAll();
foreach ($taxRates as $taxRate){
$taxRatesList[$taxRate->getId()]['title'] = $taxRate->getTitle();
$taxRatesList[$taxRate->getId()]['value'] = $taxRate->getValue();
}

$taxRatesList['default']['title'] = $this->globalParam->getCurrentMerchantTaxRate()->getTitle();
$taxRatesList['default']['value'] = $this->globalParam->getCurrentMerchantTaxRate()->getValue();
return $taxRatesList;
}

public static function getDayByNumber($number, $lang = 'fr')
@@ -137,6 +63,11 @@ class Utils
return in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1']) ;
}

public function getCookieDomain()
{
return ($this->isServerLocalhost()) ? null : $this->parameterBag->get('app.cookie_domain_distant') ;
}

function limitText($text, $limit) {
if (str_word_count($text, 0) > $limit) {
$words = str_word_count($text, 2);
@@ -146,6 +77,15 @@ class Utils
return $text;
}

public function isBot()
{
if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/bot|crawl|slurp|spider/i', $_SERVER['HTTP_USER_AGENT'])) {
return TRUE;
} else {
return FALSE;
}
}

public function slugify($string)
{
$slugify = new Slugify();

+ 9
- 3
ShopBundle/Twig/BridgeTwigExtension.php Datei anzeigen

@@ -4,6 +4,8 @@ namespace Lc\ShopBundle\Twig;

use Lc\ShopBundle\Context\PageInterface;
use Lc\ShopBundle\Form\Frontend\NewsletterType;
use Lc\ShopBundle\Services\TaxRateUtils;
use Lc\ShopBundle\Services\UnitUtils;
use Lc\ShopBundle\Services\Utils;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
@@ -12,10 +14,14 @@ use Twig\TwigFunction;
class BridgeTwigExtension extends AbstractExtension
{
private $utils ;
private $taxRateUtils ;
private $unitUtils ;

public function __construct(Utils $utils)
public function __construct(Utils $utils, TaxRateUtils $taxRateUtils, UnitUtils $unitUtils)
{
$this->utils = $utils ;
$this->taxRateUtils = $taxRateUtils ;
$this->unitUtils = $unitUtils ;
}

public function getFunctions()
@@ -43,12 +49,12 @@ class BridgeTwigExtension extends AbstractExtension

public function getUnitsList()
{
return $this->utils->getUnitsList() ;
return $this->unitUtils->getUnitsList() ;
}

public function getTaxRatesList()
{
return $this->utils->getTaxRatesList() ;
return $this->taxRateUtils->getTaxRatesList() ;
}

public function getElementByDevAlias($devAlias, $class = PageInterface::class)

+ 5
- 8
ShopBundle/Twig/FrontendTwigExtension.php Datei anzeigen

@@ -2,15 +2,12 @@

namespace Lc\ShopBundle\Twig;

use App\Repository\HubRepository;
use App\Services\GlobalParam;
use Doctrine\ORM\EntityManagerInterface;
use Lc\ShopBundle\Context\GlobalParamInterface;
use Lc\ShopBundle\Context\MerchantInterface;
use Lc\ShopBundle\Context\MerchantUtilsInterface;
use Lc\ShopBundle\Context\ProductCategoryInterface;
use Lc\ShopBundle\Context\ProductFamilyInterface;
use Lc\ShopBundle\Form\Frontend\NewsletterType;
use Lc\ShopBundle\Repository\ProductCategoryRepository;
use Liip\ImagineBundle\Imagine\Cache\CacheManager;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormFactoryInterface;
@@ -24,7 +21,7 @@ class FrontendTwigExtension extends AbstractExtension
{
protected $em ;
protected $security ;
protected $globalParam ;
protected $merchantUtils ;
protected $formFactory ;
protected $requestStack ;
protected $productCategoryRepository ;
@@ -33,13 +30,13 @@ class FrontendTwigExtension extends AbstractExtension
protected $liipCacheHelper ;
protected $parameterBag ;

public function __construct(EntityManagerInterface $em, Security $security, GlobalParamInterface $globalParam,
public function __construct(EntityManagerInterface $em, Security $security, MerchantUtilsInterface $merchantUtils,
FormFactoryInterface $formFactory, RequestStack $requestStack, CacheManager $liipCacheHelper,
ParameterBagInterface $parameterBag)
{
$this->em = $em ;
$this->security = $security ;
$this->globalParam = $globalParam ;
$this->merchantUtils = $merchantUtils ;
$this->formFactory = $formFactory ;
$this->requestStack = $requestStack ;
$this->productCategoryRepository = $this->em->getRepository($this->em->getClassMetadata(ProductCategoryInterface::class)->getName()) ;
@@ -96,7 +93,7 @@ ParameterBagInterface $parameterBag)

public function getProductCategories()
{
$categories = $this->productCategoryRepository->findAllParents($this->globalParam->getCurrentMerchant()) ;
$categories = $this->productCategoryRepository->findAllParents($this->merchantUtils->getMerchantCurrent()) ;
return $categories ;
}


Laden…
Abbrechen
Speichern