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.

40 line
930B

  1. <?php
  2. namespace domain\Order\ProductOrder;
  3. use domain\Order\Order\Order;
  4. use domain\_\AbstractRepository;
  5. class ProductOrderRepository extends AbstractRepository
  6. {
  7. protected ProductOrderRepositoryQuery $query;
  8. public function loadDependencies(): void
  9. {
  10. $this->loadQuery(ProductOrderRepositoryQuery::class);
  11. }
  12. public function getDefaultOptionsSearch(): array
  13. {
  14. return [
  15. self::WITH => ['taxRate'],
  16. self::JOIN_WITH => [],
  17. self::ORDER_BY => '',
  18. self::ATTRIBUTE_ID_PRODUCER => ''
  19. ];
  20. }
  21. public function findOneProductOrderById(int $id)
  22. {
  23. return $this->createDefaultQuery()
  24. ->filterById($id)
  25. ->findOne();
  26. }
  27. public function findProductOrdersByOrder(Order $order): array
  28. {
  29. return $this->createDefaultQuery()
  30. ->filterByOrder($order)
  31. ->find();
  32. }
  33. }