loadQuery(ProductPriceRepositoryQuery::class); } /** * Retourne les options de base nécessaires à la fonction de recherche. */ public function getDefaultOptionsSearch(): array { return [ self::WITH => ['user', 'pointSale', 'userGroup'], self::JOIN_WITH => ['product'], self::ORDER_BY => '', self::ATTRIBUTE_ID_PRODUCER => 'product.id_producer' ]; } public function findOneProductPriceById(int $id): ?ProductPrice { return $this->createDefaultQuery() ->filterById($id) ->findOne(); } public function findOneProductPriceBy(Product $product, User $user = null, UserGroup $userGroup = null, PointSale $pointSale = null, float $fromQuantity = null) { $query = $this->createDefaultQuery() ->filterByProduct($product); if($user) { $query->filterByUser($user); } if($userGroup) { $query->filterByUserGroup($userGroup); } if($pointSale) { $query->filterByPointSale($pointSale); } if($fromQuantity) { $query->filterByFromQuantity($fromQuantity); } return $query->findOne(); } }