diff --git a/src/Finder/ProductAttributesFinder.php b/src/Finder/ProductAttributesFinder.php index c79aaa51..d161382a 100644 --- a/src/Finder/ProductAttributesFinder.php +++ b/src/Finder/ProductAttributesFinder.php @@ -27,14 +27,19 @@ final class ProductAttributesFinder implements ProductAttributesFinderInterface /** @var string */ private $taxonsProperty; + /** @var int */ + private $filterMax; + public function __construct( FinderInterface $attributesFinder, QueryBuilderInterface $attributesByTaxonQueryBuilder, - string $taxonsProperty + string $taxonsProperty, + int $filterMax = 20 ) { $this->attributesFinder = $attributesFinder; $this->attributesByTaxonQueryBuilder = $attributesByTaxonQueryBuilder; $this->taxonsProperty = $taxonsProperty; + $this->filterMax = $filterMax; } public function findByTaxon(TaxonInterface $taxon): ?array @@ -44,6 +49,6 @@ public function findByTaxon(TaxonInterface $taxon): ?array $query = $this->attributesByTaxonQueryBuilder->buildQuery($data); - return $this->attributesFinder->find($query, 20); + return $this->attributesFinder->find($query, $this->filterMax); } } diff --git a/src/Finder/ProductOptionsFinder.php b/src/Finder/ProductOptionsFinder.php index 764f607b..2100eab2 100644 --- a/src/Finder/ProductOptionsFinder.php +++ b/src/Finder/ProductOptionsFinder.php @@ -27,14 +27,19 @@ final class ProductOptionsFinder implements ProductOptionsFinderInterface /** @var string */ private $taxonsProperty; + /** @var int */ + private $filterMax; + public function __construct( FinderInterface $optionsFinder, QueryBuilderInterface $productOptionsByTaxonQueryBuilder, - string $taxonsProperty + string $taxonsProperty, + int $filterMax = 20 ) { $this->optionsFinder = $optionsFinder; $this->productOptionsByTaxonQueryBuilder = $productOptionsByTaxonQueryBuilder; $this->taxonsProperty = $taxonsProperty; + $this->filterMax = $filterMax; } public function findByTaxon(TaxonInterface $taxon): ?array @@ -44,6 +49,6 @@ public function findByTaxon(TaxonInterface $taxon): ?array $query = $this->productOptionsByTaxonQueryBuilder->buildQuery($data); - return $this->optionsFinder->find($query, 20); + return $this->optionsFinder->find($query, $this->filterMax); } } diff --git a/src/Resources/config/services/finder.xml b/src/Resources/config/services/finder.xml index a2c1946a..2b5b645e 100644 --- a/src/Resources/config/services/finder.xml +++ b/src/Resources/config/services/finder.xml @@ -16,12 +16,14 @@ %bitbag_es_shop_option_taxons_property% + %bitbag_es_filter_options_max% %bitbag_es_shop_attribute_taxons_property% + %bitbag_es_filter_attributes_max% diff --git a/src/Resources/config/services/property_builder.xml b/src/Resources/config/services/property_builder.xml index 16894cfb..faa6f724 100644 --- a/src/Resources/config/services/property_builder.xml +++ b/src/Resources/config/services/property_builder.xml @@ -4,6 +4,8 @@ + 20 + 20