|
|
@@ -14,42 +14,42 @@ use Lc\ShopBundle\Model\ProductFamily; |
|
|
|
*/ |
|
|
|
class ProductRepository extends BaseRepository implements DefaultRepositoryInterface |
|
|
|
{ |
|
|
|
public function getInterfaceClass() |
|
|
|
{ |
|
|
|
return ProductInterface::class; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function findProductByAvailabilitiesNegative() |
|
|
|
{ |
|
|
|
$qb = $this->createQueryBuilder('e'); |
|
|
|
$qb->innerJoin('e.productFamily', 'productFamily'); |
|
|
|
$qb->addSelect('productFamily'); |
|
|
|
$qb->where('productFamily.merchant = :currentMerchant'); |
|
|
|
$qb->andWhere('productFamily.status = 1'); |
|
|
|
$qb->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent()->getId()); |
|
|
|
|
|
|
|
$qb->andWhere( |
|
|
|
$qb->expr()->orX( |
|
|
|
$qb->expr()->andX( |
|
|
|
$qb->expr()->orX( |
|
|
|
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProductFamily', |
|
|
|
'productFamily.behaviorCountStock LIKE :behaviorCountStockByMeasure' |
|
|
|
), |
|
|
|
'productFamily.availableQuantity < 0 ' |
|
|
|
public function getInterfaceClass() |
|
|
|
{ |
|
|
|
return ProductInterface::class; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function findProductByAvailabilitiesNegative() |
|
|
|
{ |
|
|
|
$qb = $this->createQueryBuilder('e'); |
|
|
|
$qb->innerJoin('e.productFamily', 'productFamily'); |
|
|
|
$qb->addSelect('productFamily'); |
|
|
|
$qb->where('productFamily.merchant = :currentMerchant'); |
|
|
|
$qb->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent()->getId()); |
|
|
|
$qb->andWhere('productFamily.status = 1'); |
|
|
|
|
|
|
|
$qb->andWhere( |
|
|
|
$qb->expr()->orX( |
|
|
|
$qb->expr()->andX( |
|
|
|
$qb->expr()->orX( |
|
|
|
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProductFamily', |
|
|
|
'productFamily.behaviorCountStock LIKE :behaviorCountStockByMeasure' |
|
|
|
), |
|
|
|
$qb->expr()->andX( |
|
|
|
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProduct', |
|
|
|
'e.availableQuantity < 0 ' |
|
|
|
) |
|
|
|
'productFamily.availableQuantity < 0 ' |
|
|
|
), |
|
|
|
$qb->expr()->andX( |
|
|
|
'productFamily.behaviorCountStock LIKE :behaviorCountStockByProduct', |
|
|
|
'e.availableQuantity < 0 ' |
|
|
|
) |
|
|
|
); |
|
|
|
$qb->setParameter('behaviorCountStockByProductFamily', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY); |
|
|
|
$qb->setParameter('behaviorCountStockByMeasure', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE); |
|
|
|
$qb->setParameter('behaviorCountStockByProduct', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT); |
|
|
|
$qb->groupBy('productFamily.id'); |
|
|
|
|
|
|
|
return $qb->getQuery()->getResult(); |
|
|
|
} |
|
|
|
) |
|
|
|
); |
|
|
|
$qb->setParameter('behaviorCountStockByProductFamily', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT_FAMILY); |
|
|
|
$qb->setParameter('behaviorCountStockByMeasure', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_MEASURE); |
|
|
|
$qb->setParameter('behaviorCountStockByProduct', ProductFamily::BEHAVIOR_COUNT_STOCK_BY_PRODUCT); |
|
|
|
$qb->groupBy('productFamily.id'); |
|
|
|
|
|
|
|
return $qb->getQuery()->getResult(); |
|
|
|
} |
|
|
|
|
|
|
|
} |