|
- <?php
-
- namespace domain\Document\Invoice;
-
- use domain\_\AbstractRepository;
-
- class InvoiceRepository extends AbstractRepository
- {
- protected InvoiceRepositoryQuery $query;
-
- public function loadDependencies(): void
- {
- $this->loadQuery(InvoiceRepositoryQuery::class);
- }
-
- public function getDefaultOptionsSearch(): array
- {
- return [
- self::WITH => ['payments'],
- self::JOIN_WITH => ['user AS user_invoice', 'producer'],
- self::ORDER_BY => 'date ASC',
- self::ATTRIBUTE_ID_PRODUCER => 'invoice.id_producer'
- ];
- }
-
- public function findOneInvoiceById(int $id): ?Invoice
- {
- return $this->createDefaultQuery()
- ->filterById($id)
- ->findOne();
- }
- }
|