Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

OrderProductRepository.php 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace Lc\ShopBundle\Repository;
  3. use Lc\ShopBundle\Context\DefaultRepositoryInterface;
  4. use Lc\ShopBundle\Context\OrderProductInterface;
  5. use Lc\ShopBundle\Model\OrderStatus;
  6. /**
  7. * @method OrderProductInterface|null find($id, $lockMode = null, $lockVersion = null)
  8. * @method OrderProductInterface|null findOneBy(array $criteria, array $orderBy = null)
  9. * @method OrderProductInterface[] findAll()
  10. * @method OrderProductInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  11. */
  12. class OrderProductRepository extends BaseRepository implements DefaultRepositoryInterface
  13. {
  14. public function getInterfaceClass()
  15. {
  16. return OrderProductInterface::class;
  17. }
  18. public function findOrderProductsInCartsByProduct($product){
  19. $qb = $this->createQueryBuilder('e');
  20. $qb->andWhere('e.product = :product');
  21. $qb->andWhere('e.redelivery = false OR e.redelivery IS NULL');
  22. $qb->setParameter('product', $product);
  23. $qb->leftJoin('e.orderShop', 'orderShop');
  24. $qb->andWhere('orderShop.merchant = :currentMerchant');
  25. $qb->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent());
  26. $qb->leftJoin('orderShop.orderStatus', 'orderStatus');
  27. $qb->andWhere('orderStatus.alias IN (:alias)');
  28. $qb->setParameter('alias',OrderStatus::ALIAS_CART);
  29. return $qb->getQuery()->getResult();
  30. }
  31. }