Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

45 lines
1.3KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Repository\Reduction;
  3. use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface;
  4. use Lc\CaracoleBundle\Repository\MerchantStoreTrait;
  5. use Lc\CaracoleBundle\Repository\AbstractStore;
  6. use Lc\SovBundle\Repository\RepositoryQueryInterface;
  7. class ReductionCatalogStore extends AbstractStore
  8. {
  9. use MerchantStoreTrait;
  10. protected ReductionCatalogRepositoryQuery $query;
  11. public function __construct(ReductionCatalogRepositoryQuery $query)
  12. {
  13. $this->query = $query;
  14. }
  15. public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  16. {
  17. $query->orderBy('id');
  18. return $query;
  19. }
  20. public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  21. {
  22. $this->addFilterByMerchantRequired($query);
  23. $query->filterIsOnlineAndOffline();
  24. return $query;
  25. }
  26. public function relationsDefault(RepositoryQueryInterface $query): RepositoryQueryInterface
  27. {
  28. return $query;
  29. }
  30. public function getByProductFamily(ProductFamilyInterface $productFamily, $query = null)
  31. {
  32. $query = $this->createDefaultQuery($query);
  33. $query->filterProductFamily($productFamily);
  34. return $query->findOne();
  35. }
  36. }