Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

49 lines
1.4KB

  1. <?php
  2. namespace domain\Distribution\PointSaleDistribution;
  3. use domain\Distribution\Distribution\Distribution;
  4. use domain\PointSale\PointSale\PointSale;
  5. use domain\_\AbstractRepository;
  6. class PointSaleDistributionRepository extends AbstractRepository
  7. {
  8. protected PointSaleDistributionRepositoryQuery $query;
  9. public function loadDependencies(): void
  10. {
  11. $this->loadQuery(PointSaleDistributionRepositoryQuery::class);
  12. }
  13. public function getDefaultOptionsSearch(): array
  14. {
  15. return [
  16. self::WITH => ['distribution', 'pointSale'],
  17. self::JOIN_WITH => [],
  18. self::ORDER_BY => '',
  19. self::ATTRIBUTE_ID_PRODUCER => ''
  20. ];
  21. }
  22. public function findOnePointSaleDistribution(Distribution $distribution, PointSale $pointSale): ?PointSaleDistribution
  23. {
  24. return $this->createDefaultQuery()
  25. ->filterByDistribution($distribution)
  26. ->filterByPointSale($pointSale)
  27. ->findOne();
  28. }
  29. public function findPointSaleDistributionsByDistribution(Distribution $distribution): array
  30. {
  31. return $this->createDefaultQuery()
  32. ->filterByDistribution($distribution)
  33. ->find();
  34. }
  35. public function countPointSaleDistributionsByDistribution(Distribution $distribution): int
  36. {
  37. return $this->createDefaultQuery()
  38. ->filterByDistribution($distribution)
  39. ->count();
  40. }
  41. }