Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

49 lines
1.2KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Product;
  3. use Lc\CaracoleBundle\Repository\SectionStoreTrait;
  4. use Lc\SovBundle\Repository\AbstractStore;
  5. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  6. class ProductStore extends AbstractStore
  7. {
  8. use SectionStoreTrait;
  9. protected ProductRepositoryQuery $query;
  10. public function __construct(ProductRepositoryQuery $query)
  11. {
  12. $this->query = $query;
  13. }
  14. public function orderByDefault(RepositoryQueryInterface $query) :RepositoryQueryInterface
  15. {
  16. return $query;
  17. }
  18. public function filtersDefault($query):RepositoryQueryInterface
  19. {
  20. $query->filterIsOnlineAndOffline();
  21. $query->filterBySection($this->section);
  22. return $query;
  23. }
  24. public function relationsDefault($query):RepositoryQueryInterface
  25. {
  26. return $query->joinProductFamily();
  27. }
  28. //findProductByAvailabilitiesNegative
  29. public function getByAvailabilitiesNegative(ProductRepositoryQuery $query = null): array
  30. {
  31. $query = $this->createDefaultQuery($query);
  32. $query->filterIsOnline();
  33. $query->filterBehaviorCountStock();
  34. $query->groupBy('pf.id');
  35. return $query->find();
  36. }
  37. }