ReductionCreditRepository.php 1.1KB

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Lc\ShopBundle\Repository;
  3. use Doctrine\ORM\EntityManager;
  4. use Lc\ShopBundle\Context\DefaultRepositoryInterface;
  5. use Lc\ShopBundle\Context\MerchantUtilsInterface;
  6. use Lc\ShopBundle\Context\ReductionCreditInterface;
  7. /**
  8. * @method ReductionCreditInterface|null find($id, $lockMode = null, $lockVersion = null)
  9. * @method ReductionCreditInterface|null findOneBy(array $criteria, array $orderBy = null)
  10. * @method ReductionCreditInterface[] findAll()
  11. * @method ReductionCreditInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  12. */
  13. class ReductionCreditRepository extends BaseRepository implements DefaultRepositoryInterface
  14. {
  15. public function getInterfaceClass()
  16. {
  17. return ReductionCreditInterface::class;
  18. }
  19. public function findReductionCreditsByUser($user)
  20. {
  21. $query = $this->findByMerchantQuery() ;
  22. $query->andWhere('e.status = 1');
  23. $query->andWhere(':user MEMBER OF e.users');
  24. $query->setParameter('user', $user);
  25. return $query->getQuery()->getResult() ;
  26. }
  27. }