Bläddra i källkod

Liste points de vente : filtre sur Merchant

reduction
Guillaume 4 år sedan
förälder
incheckning
db282adce2
1 ändrade filer med 13 tillägg och 1 borttagningar
  1. +13
    -1
      ShopBundle/Controller/Admin/AdminController.php

+ 13
- 1
ShopBundle/Controller/Admin/AdminController.php Visa fil

@@ -22,7 +22,14 @@ class AdminController extends EasyAdminController
$dqlFilter = sprintf(str_replace('currentMerchant', $this->getUser()->getMerchant()->getId(), $dqlFilter));
}

return parent::createListQueryBuilder($entityClass, $sortDirection, $sortField, $dqlFilter);
$queryBuilder = parent::createListQueryBuilder($entityClass, $sortDirection, $sortField, $dqlFilter);

if($entityClass == 'App\Entity\PointSale') {
$queryBuilder->andWhere(':currentMerchant MEMBER OF entity.merchant')
->setParameter(':currentMerchant',$this->getUser()->getMerchant()->getId()) ;
}

return $queryBuilder ;
}


@@ -60,7 +67,12 @@ class AdminController extends EasyAdminController

if (method_exists($entity, 'setMerchant')) {
$entity->setMerchant($this->security->getUser()->getMerchant());
}

if (method_exists($entity, 'addMerchant')) {
if($entity->getMerchant()->isEmpty()) {
$entity->addMerchant($this->security->getUser()->getMerchant());
}
}

if (method_exists($entity, 'setCreatedAt')) {

Laddar…
Avbryt
Spara