Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

48 rindas
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. }
  23. public function relationsDefault($query):RepositoryQueryInterface
  24. {
  25. return $query->joinProductFamily();
  26. }
  27. //findProductByAvailabilitiesNegative
  28. public function getByAvailabilitiesNegative(ProductRepositoryQuery $query = null): array
  29. {
  30. $query = $this->createDefaultQuery($query);
  31. $query->filterIsOnline();
  32. $query->filterBehaviorCountStock();
  33. $query->groupBy('pf.id');
  34. return $query->find();
  35. }
  36. }