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.

33 lines
850B

  1. <?php
  2. namespace common\logic\Document\Quotation\Repository;
  3. use common\logic\AbstractRepository;
  4. use common\logic\Document\Quotation\Model\Quotation;
  5. class QuotationRepository extends AbstractRepository
  6. {
  7. protected QuotationRepositoryQuery $query;
  8. public function loadDependencies(): void
  9. {
  10. $this->loadQuery(QuotationRepositoryQuery::class);
  11. }
  12. public function getDefaultOptionsSearch(): array
  13. {
  14. return [
  15. self::WITH => [],
  16. self::JOIN_WITH => ['user AS user_quotation', 'producer'],
  17. self::ORDER_BY => 'date ASC',
  18. self::ATTRIBUTE_ID_PRODUCER => 'quotation.id_producer'
  19. ];
  20. }
  21. public function findOneQuotationById(int $id): ?Quotation
  22. {
  23. return $this->createDefaultQuery()
  24. ->filterById($id)
  25. ->findOne();
  26. }
  27. }