|
123456789101112131415161718192021222324252627282930313233343536373839 |
- <?php
-
- namespace Lc\ShopBundle\Repository;
-
- use Lc\ShopBundle\Context\DefaultRepositoryInterface;
- use Lc\ShopBundle\Context\OrderProductInterface;
- use Lc\ShopBundle\Model\OrderStatus;
-
- /**
- * @method OrderProductInterface|null find($id, $lockMode = null, $lockVersion = null)
- * @method OrderProductInterface|null findOneBy(array $criteria, array $orderBy = null)
- * @method OrderProductInterface[] findAll()
- * @method OrderProductInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
- */
- class OrderProductRepository extends BaseRepository implements DefaultRepositoryInterface
- {
- public function getInterfaceClass()
- {
- return OrderProductInterface::class;
- }
-
- public function findOrderProductsInCartsByProduct($product){
- $qb = $this->createQueryBuilder('e');
- $qb->andWhere('e.product = :product');
- $qb->andWhere('e.redelivery = false OR e.redelivery IS NULL');
- $qb->setParameter('product', $product);
- $qb->leftJoin('e.orderShop', 'orderShop');
- $qb->andWhere('orderShop.merchant = :currentMerchant');
- $qb->setParameter('currentMerchant', $this->merchantUtils->getMerchantCurrent());
- $qb->leftJoin('orderShop.orderStatus', 'orderStatus');
- $qb->andWhere('orderStatus.alias IN (:alias)');
- $qb->setParameter('alias',OrderStatus::ALIAS_CART);
-
- return $qb->getQuery()->getResult();
-
- }
-
-
- }
|