You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CreditHistoryStore.php 1.6KB

3 yıl önce
3 yıl önce
3 yıl önce
3 yıl önce
3 yıl önce
3 yıl önce
3 yıl önce
3 yıl önce
3 yıl önce
3 yıl önce
3 yıl önce
3 yıl önce
3 yıl önce
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Credit;
  3. use App\Entity\User\UserMerchant;
  4. use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
  5. use Lc\SovBundle\Repository\AbstractStore;
  6. use DateTime;
  7. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  8. class CreditHistoryStore extends AbstractStore
  9. {
  10. use MerchantStoreTrait;
  11. protected CreditHistoryRepositoryQuery $query;
  12. public function __construct(CreditHistoryRepositoryQuery $query)
  13. {
  14. $this->query = $query;
  15. }
  16. public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  17. {
  18. $query->orderBy('createdAt');
  19. return $query;
  20. }
  21. public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  22. {
  23. $query->filterByMerchant($this->merchant);
  24. return $query;
  25. }
  26. public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  27. {
  28. return $query;
  29. }
  30. //findAllByDateStartEnd
  31. public function getByDateStartEnd(DateTime $dateStart, DateTime $dateEnd, $query = null): array
  32. {
  33. $query = $this->createDefaultQuery($query);
  34. $query
  35. ->filterByDateStart($dateStart)
  36. ->filterByDateEnd($dateEnd);
  37. return $query->find();
  38. }
  39. //findAllByUserMerchant
  40. public function getByUserMerchant(UserMerchant $userMerchant, $query = null): array
  41. {
  42. $query = $this->createDefaultQuery($query);
  43. $query
  44. ->filterByUserMerchant($userMerchant)
  45. ->orderBy('createdAt', 'DESC');
  46. return $query->find();
  47. }
  48. }