Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface VirtualRuleInterface
*
* @return \Smile\ElasticsuiteCore\Search\Request\QueryInterface
*/
public function getCategorySearchQuery($category, $excludedCategories = []);
public function getCategorySearchQuery($category, &$excludedCategories = []);

/**
* Retrieve search queries of children categories.
Expand Down
12 changes: 6 additions & 6 deletions src/module-elasticsuite-virtual-category/Model/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function __toString(): string
*
* @return QueryInterface|null
*/
public function getCategorySearchQuery($category, $excludedCategories = []): ?QueryInterface
public function getCategorySearchQuery($category, &$excludedCategories = []): ?QueryInterface
{
$query = null;

Expand Down Expand Up @@ -307,7 +307,7 @@ private function getRootCategory(int $rootCategoryId, int $storeId = null)
*
* @return QueryInterface
*/
private function getStandardCategoryQuery(CategoryInterface $category, $excludedCategories = []): QueryInterface
private function getStandardCategoryQuery(CategoryInterface $category, &$excludedCategories = []): QueryInterface
{
return $this->getStandardCategoriesQuery([$category->getId()], $excludedCategories);
}
Expand All @@ -320,7 +320,7 @@ private function getStandardCategoryQuery(CategoryInterface $category, $excluded
*
* @return QueryInterface
*/
private function getStandardCategoriesQuery(array $categoryIds, $excludedCategories): QueryInterface
private function getStandardCategoriesQuery(array $categoryIds, &$excludedCategories): QueryInterface
{
$conditionsParams = ['data' => ['attribute' => 'category_ids', 'operator' => '()', 'value' => $categoryIds]];
$categoryCondition = $this->productConditionsFactory->create($conditionsParams);
Expand All @@ -338,7 +338,7 @@ private function getStandardCategoriesQuery(array $categoryIds, $excludedCategor
*/
private function getVirtualCategoryQuery(
CategoryInterface $category,
$excludedCategories = []
&$excludedCategories = []
): ?QueryInterface {
$query = $category->getVirtualRule()->getConditions()->getSearchQuery($excludedCategories);
$rootCategory = $this->getVirtualRootCategory($category);
Expand Down Expand Up @@ -367,7 +367,7 @@ private function getVirtualCategoryQuery(
*
* @return \Smile\ElasticsuiteCore\Search\Request\QueryInterface
*/
private function addChildrenQueries($query, CategoryInterface $category, $excludedCategories = []): QueryInterface
private function addChildrenQueries($query, CategoryInterface $category, &$excludedCategories = []): QueryInterface
{
$childrenCategories = $this->getChildrenCategories($category, $excludedCategories);
$childrenCategoriesIds = [];
Expand Down Expand Up @@ -406,7 +406,7 @@ private function addChildrenQueries($query, CategoryInterface $category, $exclud
*
* @return Collection
*/
private function getChildrenCategories(CategoryInterface $category, $excludedCategories = []): Collection
private function getChildrenCategories(CategoryInterface $category, &$excludedCategories = []): Collection
{
$storeId = $category->getStoreId();
$categoryCollection = $this->categoryCollectionFactory->create()->setStoreId($storeId);
Expand Down