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.

36 lines
886B

  1. <?php
  2. namespace common\logic\Payment\Repository;
  3. use common\logic\AbstractRepository;
  4. use common\logic\Order\Order\Model\Order;
  5. use common\logic\Payment\Model\Payment;
  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. ],
  19. self::JOIN_WITH => [],
  20. self::ORDER_BY => Payment::tableName() . '.date ASc',
  21. self::ATTRIBUTE_ID_PRODUCER => Payment::tableName() . '.id_producer'
  22. ];
  23. }
  24. public function getByOrder(Order $order)
  25. {
  26. return $this->createDefaultQuery()
  27. ->filterByOrder($order)
  28. ->find();
  29. }
  30. }