Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1583 deleting optimizer w/query limitation #1584

Merged
Merged
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 @@ -112,7 +112,7 @@ private function getSearchQueryIdentities()

if (!empty($data['quick_search_container']['query_ids'])) {
foreach ($data['quick_search_container']['query_ids'] as $query) {
$queryIds[] = $query['id'];
$queryIds[] = $query['id'] ?? $query;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,22 @@ public function execute($entity, $arguments = [])
{
if ($entity->getId()) {
$searchContainers = $entity->getResource()->getSearchContainersFromOptimizerId($entity->getId());
$this->getCategoryLimitation($entity, $searchContainers);
$this->getSearchQueryLimitation($entity, $searchContainers);
$this->setCategoryLimitation($entity, $searchContainers);
$this->setSearchQueryLimitation($entity, $searchContainers);
}

return $entity;
}

/**
* Retrieve category ids limitation for the current optimizer, if any.
* Retrieve and set category ids limitation for the current optimizer, if any.
*
* @param OptimizerInterface $entity The optimizer being saved
* @param OptimizerInterface $entity The optimizer being read
* @param array $searchContainers Search Containers data for the current optimizer.
*
* @return array
* @return void
*/
private function getCategoryLimitation($entity, $searchContainers)
private function setCategoryLimitation($entity, $searchContainers)
{
$applyTo = (bool) ($searchContainers['catalog_view_container'] ?? false);

Expand All @@ -77,14 +77,14 @@ private function getCategoryLimitation($entity, $searchContainers)
}

/**
* Retrieve query ids limitation for the current optimizer, if any.
* Retrieve and set query ids limitation for the current optimizer, if any.
*
* @param OptimizerInterface $entity The optimizer being saved
* @param OptimizerInterface $entity The optimizer being read
* @param array $searchContainers Search Containers data for the current optimizer.
*
* @return array
* @return void
*/
private function getSearchQueryLimitation($entity, $searchContainers)
private function setSearchQueryLimitation($entity, $searchContainers)
{
$applyTo = (bool) ($searchContainers['quick_search_container'] ?? ($searchContainers['catalog_product_autocomplete'] ?? false));

Expand All @@ -97,7 +97,5 @@ private function getSearchQueryLimitation($entity, $searchContainers)
}
$entity->setData('quick_search_container', $containerData);
}

return $entity;
}
}