Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

ReductionCartRepository.php 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace Lc\ShopBundle\Repository;
  3. use Lc\ShopBundle\Context\DefaultRepositoryInterface;
  4. use Lc\ShopBundle\Context\ReductionCartInterface;
  5. /**
  6. * @method ReductionCartInterface|null find($id, $lockMode = null, $lockVersion = null)
  7. * @method ReductionCartInterface|null findOneBy(array $criteria, array $orderBy = null)
  8. * @method ReductionCartInterface[] findAll()
  9. * @method ReductionCartInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  10. */
  11. class ReductionCartRepository extends BaseRepository implements DefaultRepositoryInterface
  12. {
  13. public function getInterfaceClass()
  14. {
  15. return ReductionCartInterface::class;
  16. }
  17. public function findOneByCode($code)
  18. {
  19. $query = $this->findByMerchantQuery() ;
  20. $query->andWhere('e.codes LIKE :code')->setParameter('code', '%'.$code.'%') ;
  21. return $query->getQuery()->getOneOrNullResult() ;
  22. }
  23. public function getValuesOfFieldType(){
  24. $query = $this->findByMerchantQuery() ;
  25. $query->select('DISTINCT e.type');
  26. $query->andWhere('e.status = 1');
  27. return $query->getQuery()->getResult() ;
  28. }
  29. public function getValuesOfFieldCode(){
  30. $query = $this->findByMerchantQuery() ;
  31. $query->select('DISTINCT e.codes');
  32. $query->andWhere('e.status = 1');
  33. return $query->getQuery()->getResult() ;
  34. }
  35. public function getEligibleReductionCart($order)
  36. {
  37. $query = $this->findByMerchantQuery() ;
  38. $query->andWhere('e.status = 1');
  39. return $query->getQuery()->getResult();
  40. }
  41. }