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.

32 line
770B

  1. <?php
  2. namespace domain\Document\Invoice;
  3. use domain\_\AbstractRepository;
  4. class InvoiceRepository extends AbstractRepository
  5. {
  6. protected InvoiceRepositoryQuery $query;
  7. public function loadDependencies(): void
  8. {
  9. $this->loadQuery(InvoiceRepositoryQuery::class);
  10. }
  11. public function getDefaultOptionsSearch(): array
  12. {
  13. return [
  14. self::WITH => ['payments'],
  15. self::JOIN_WITH => ['user AS user_invoice', 'producer'],
  16. self::ORDER_BY => 'date ASC',
  17. self::ATTRIBUTE_ID_PRODUCER => 'invoice.id_producer'
  18. ];
  19. }
  20. public function findOneInvoiceById(int $id): ?Invoice
  21. {
  22. return $this->createDefaultQuery()
  23. ->filterById($id)
  24. ->findOne();
  25. }
  26. }