Browse Source

Liste points de vente : filtre sur Merchant

reduction
Guillaume 4 years ago
parent
commit
db282adce2
1 changed files with 13 additions and 1 deletions
  1. +13
    -1
      ShopBundle/Controller/Admin/AdminController.php

+ 13
- 1
ShopBundle/Controller/Admin/AdminController.php View File

$dqlFilter = sprintf(str_replace('currentMerchant', $this->getUser()->getMerchant()->getId(), $dqlFilter)); $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 ;
} }






if (method_exists($entity, 'setMerchant')) { if (method_exists($entity, 'setMerchant')) {
$entity->setMerchant($this->security->getUser()->getMerchant()); $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')) { if (method_exists($entity, 'setCreatedAt')) {

Loading…
Cancel
Save