|
- <?php
-
- namespace Lc\ShopBundle\Repository;
-
- use Lc\ShopBundle\Context\DefaultRepositoryInterface;
- use Lc\ShopBundle\Context\ReductionCartInterface;
-
- /**
- * @method ReductionCartInterface|null find($id, $lockMode = null, $lockVersion = null)
- * @method ReductionCartInterface|null findOneBy(array $criteria, array $orderBy = null)
- * @method ReductionCartInterface[] findAll()
- * @method ReductionCartInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
- */
- class ReductionCartRepository extends BaseRepository implements DefaultRepositoryInterface
- {
- public function getInterfaceClass()
- {
- return ReductionCartInterface::class;
- }
-
- public function findOneByCode($code)
- {
- $query = $this->findByMerchantQuery() ;
- $query->andWhere('e.codes LIKE :code')->setParameter('code', '%'.$code.'%') ;
- return $query->getQuery()->getOneOrNullResult() ;
- }
-
- public function getValuesOfFieldType(){
- $query = $this->findByMerchantQuery() ;
- $query->select('DISTINCT e.type');
- $query->andWhere('e.status = 1');
-
- return $query->getQuery()->getResult() ;
-
- }
-
- public function getValuesOfFieldCode(){
- $query = $this->findByMerchantQuery() ;
- $query->select('DISTINCT e.codes');
- $query->andWhere('e.status = 1');
-
- return $query->getQuery()->getResult() ;
-
- }
-
- public function getEligibleReductionCart($order)
- {
- $query = $this->findByMerchantQuery() ;
- $query->andWhere('e.status = 1');
-
- return $query->getQuery()->getResult();
-
- }
-
-
- }
|