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.

42 satır
1.2KB

  1. <?php
  2. namespace common\logic\Distribution\PointSaleDistribution;
  3. use common\logic\BaseService;
  4. use common\logic\Distribution\Distribution\Distribution;
  5. use common\logic\PointSale\PointSale\PointSale;
  6. use common\logic\RepositoryInterface;
  7. class PointSaleDistributionRepository extends BaseService implements RepositoryInterface
  8. {
  9. public function defaultOptionsSearch() {
  10. return [
  11. 'with' => ['distribution', 'pointSale'],
  12. 'join_with' => [],
  13. 'orderby' => '',
  14. 'attribute_id_producer' => ''
  15. ] ;
  16. }
  17. public function getOne(Distribution $distribution, PointSale $pointSale): ?PointSaleDistribution
  18. {
  19. return PointSaleDistribution::searchOne([
  20. 'id_distribution' => $distribution->id,
  21. 'id_point_sale' => $pointSale->id
  22. ]);
  23. }
  24. public function getByDistribution(Distribution $distribution)
  25. {
  26. return PointSaleDistribution::searchAll([
  27. 'id_distribution' => $distribution->id
  28. ]) ;
  29. }
  30. public function countByDistribution(Distribution $distribution): int
  31. {
  32. return PointSaleDistribution::searchCount([
  33. 'id_distribution' => $distribution->id
  34. ]);
  35. }
  36. }