|
|
|
|
|
|
|
|
$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')) { |