您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

InvoiceRepository.php 770B

1234567891011121314151617181920212223242526272829303132
  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. }