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.

ProductPriceRepositoryQuery.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace domain\Product\ProductPrice\Repository;
  3. use domain\PointSale\PointSale\PointSale;
  4. use domain\Product\Product\Product;
  5. use domain\Product\ProductPrice\Service\ProductPriceDefinition;
  6. use domain\User\User\User;
  7. use domain\User\UserGroup\UserGroup;
  8. use domain\_\AbstractRepositoryQuery;
  9. class ProductPriceRepositoryQuery extends AbstractRepositoryQuery
  10. {
  11. protected ProductPriceDefinition $definition;
  12. public function loadDependencies(): void
  13. {
  14. $this->loadDefinition(ProductPriceDefinition::class);
  15. }
  16. public function filterByProduct(Product $product): self
  17. {
  18. $this->andWhere(['id_product' => $product->id]);
  19. return $this;
  20. }
  21. public function filterByUser(User $user): self
  22. {
  23. $this->andWhere(['id_user' => $user->id]);
  24. return $this;
  25. }
  26. public function filterByUserGroup(UserGroup $userGroup): self
  27. {
  28. $this->andWhere(['id_user_group' => $userGroup->id]);
  29. return $this;
  30. }
  31. public function filterByPointSale(PointSale $pointSale): self
  32. {
  33. $this->andWhere(['id_point_sale' => $pointSale->id]);
  34. return $this;
  35. }
  36. public function filterByFromQuantity(float $fromQuantity): self
  37. {
  38. $this->andWhere(['from_quantity' => $fromQuantity]);
  39. return $this;
  40. }
  41. }