loadQuery(UserPointSaleRepositoryQuery::class); $this->pointSaleSolver = $this->loadService(PointSaleSolver::class); } public function getDefaultOptionsSearch(): array { return [ self::WITH => [], self::JOIN_WITH => [], self::ORDER_BY => '', self::ATTRIBUTE_ID_PRODUCER => 'point_sale.id_producer' ] ; } public function findUserPointSalesByUser(User $user, Distribution $distribution = null): array { $userPointSalesArray = $this->createDefaultQuery() ->joinPointSale() ->filterByUser($user) ->find(); if($distribution) { $userPointSalesArray = $this->pointSaleSolver->filterUserPointSalesByDistribution($userPointSalesArray, $distribution); } return $userPointSalesArray; } public function findOneUserPointSale(User $user = null, PointSale $pointSale = null) { if(!$user || !$pointSale) { return null; } return $this->createDefaultQuery() ->joinPointSale() ->filterByUser($user) ->filterByPointSale($pointSale) ->findOne(); } }