No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

44 líneas
1.8KB

  1. <?php
  2. namespace Lc\ShopBundle\Repository;
  3. use Lc\ShopBundle\Context\DefaultRepositoryInterface;
  4. use Lc\ShopBundle\Context\CreditHistoryInterface;
  5. /**
  6. * @method CreditHistoryInterface|null find($id, $lockMode = null, $lockVersion = null)
  7. * @method CreditHistoryInterface|null findOneBy(array $criteria, array $orderBy = null)
  8. * @method CreditHistoryInterface[] findAll()
  9. * @method CreditHistoryInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
  10. */
  11. class CreditHistoryRepository extends BaseRepository implements DefaultRepositoryInterface
  12. {
  13. public function getInterfaceClass()
  14. {
  15. return CreditHistoryInterface::class;
  16. }
  17. public function findAllByDateStartEnd($merchant, $dateStart, $dateEnd)
  18. {
  19. return $this->createQueryBuilder('e')
  20. ->innerJoin('e.userMerchant', 'user_merchant')
  21. ->andWhere('user_merchant.merchant = :merchant')
  22. ->setParameter(':merchant', $merchant)
  23. ->andWhere('e.createdAt >= :dateStart')
  24. ->andWhere('e.createdAt <= :dateEnd')
  25. ->setParameter(':dateStart', $dateStart)
  26. ->setParameter(':dateEnd', $dateEnd)
  27. ->addOrderBy('e.createdAt', 'ASC')
  28. ->getQuery()->getResult();
  29. }
  30. public function findAllByUserMerchant($userMerchant)
  31. {
  32. return $this->createQueryBuilder('e')
  33. ->andWhere('e.userMerchant = :userMerchant')
  34. ->setParameter('userMerchant', $userMerchant)
  35. ->addOrderBy('e.createdAt', 'DESC')
  36. ->getQuery()->getResult();
  37. }
  38. }