|
- <?php
-
- namespace common\logic\Distribution\PointSaleDistribution;
-
- use common\logic\BaseService;
- use common\logic\Distribution\Distribution\Distribution;
- use common\logic\PointSale\PointSale\PointSale;
- use common\logic\RepositoryInterface;
-
- class PointSaleDistributionRepository extends BaseService implements RepositoryInterface
- {
- public function defaultOptionsSearch() {
- return [
- 'with' => ['distribution', 'pointSale'],
- 'join_with' => [],
- 'orderby' => '',
- 'attribute_id_producer' => ''
- ] ;
- }
-
- public function getOne(Distribution $distribution, PointSale $pointSale): ?PointSaleDistribution
- {
- return PointSaleDistribution::searchOne([
- 'id_distribution' => $distribution->id,
- 'id_point_sale' => $pointSale->id
- ]);
- }
-
- public function getByDistribution(Distribution $distribution)
- {
- return PointSaleDistribution::searchAll([
- 'id_distribution' => $distribution->id
- ]) ;
- }
-
- public function countByDistribution(Distribution $distribution): int
- {
- return PointSaleDistribution::searchCount([
- 'id_distribution' => $distribution->id
- ]);
- }
- }
|