Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

51 lines
1.2KB

  1. <?php
  2. namespace domain\Payment;
  3. use domain\Order\Order\Order;
  4. use domain\User\User\User;
  5. use domain\_\AbstractRepository;
  6. class PaymentRepository extends AbstractRepository
  7. {
  8. protected PaymentRepositoryQuery $query;
  9. public function loadDependencies(): void
  10. {
  11. $this->loadQuery(PaymentRepositoryQuery::class);
  12. }
  13. public function getDefaultOptionsSearch(): array
  14. {
  15. return [
  16. self::WITH => [
  17. 'user',
  18. 'order',
  19. 'userAction'
  20. ],
  21. self::JOIN_WITH => [],
  22. self::ORDER_BY => Payment::tableName() . '.date ASc',
  23. self::ATTRIBUTE_ID_PRODUCER => Payment::tableName() . '.id_producer'
  24. ];
  25. }
  26. public function getByOrder(Order $order)
  27. {
  28. return $this->createDefaultQuery()
  29. ->filterByOrder($order)
  30. ->find();
  31. }
  32. public function queryPaymentsCreditHistoryByUser(User $user)
  33. {
  34. return $this->createDefaultQuery()
  35. ->filterByUser($user)
  36. ->filterIsCredit()
  37. ->orderBy('date DESC');
  38. }
  39. public function findPaymentsCreditHistoryByUser(User $user): array
  40. {
  41. return $this->queryPaymentsCreditHistoryByUser($user)->find();
  42. }
  43. }