Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

40 rindas
1.5KB

  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. }