Skip to content

Commit 3c50c7c

Browse files
committed
#21772: Static test fix.
1 parent b34eb7a commit 3c50c7c

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Filter/Preprocessor.php

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
use Magento\Catalog\Api\Data\ProductInterface;
99
use Magento\Catalog\Model\Product;
1010
use Magento\Catalog\Model\ResourceModel\Eav\Attribute;
11+
use Magento\CatalogSearch\Model\Search\FilterMapper\VisibilityFilter;
1112
use Magento\CatalogSearch\Model\Search\TableMapper;
13+
use Magento\Customer\Model\Session;
1214
use Magento\Eav\Model\Config;
1315
use Magento\Framework\App\Config\ScopeConfigInterface;
1416
use Magento\Framework\App\ObjectManager;
@@ -20,10 +22,11 @@
2022
use Magento\Framework\Search\Adapter\Mysql\Filter\PreprocessorInterface;
2123
use Magento\Framework\Search\Request\FilterInterface;
2224
use Magento\Store\Model\Store;
23-
use Magento\Customer\Model\Session;
24-
use Magento\CatalogSearch\Model\Search\FilterMapper\VisibilityFilter;
2525

2626
/**
27+
* ElasticSearch search filter pre-processor.
28+
*
29+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
2730
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2831
* @deprecated
2932
* @see \Magento\ElasticSearch
@@ -128,18 +131,21 @@ public function __construct(
128131
}
129132

130133
/**
131-
* {@inheritdoc}
134+
* @inheritdoc
132135
*/
133136
public function process(FilterInterface $filter, $isNegation, $query)
134137
{
135138
return $this->processQueryWithField($filter, $isNegation, $query);
136139
}
137140

138141
/**
142+
* Process query with field.
143+
*
139144
* @param FilterInterface $filter
140145
* @param bool $isNegation
141146
* @param string $query
142147
* @return string
148+
* @throws \Magento\Framework\Exception\LocalizedException
143149
*/
144150
private function processQueryWithField(FilterInterface $filter, $isNegation, $query)
145151
{
@@ -204,19 +210,23 @@ private function processQueryWithField(FilterInterface $filter, $isNegation, $qu
204210
->where('main_table.store_id = ?', Store::DEFAULT_STORE_ID)
205211
->having($query);
206212

207-
$resultQuery = 'search_index.entity_id IN (
208-
select entity_id from ' . $this->conditionManager->wrapBrackets($select) . ' as filter
209-
)';
213+
$resultQuery = 'search_index.entity_id IN ('
214+
. 'select entity_id from '
215+
. $this->conditionManager->wrapBrackets($select)
216+
. ' as filter)';
210217
}
211218

212219
return $resultQuery;
213220
}
214221

215222
/**
223+
* Process range numeric.
224+
*
216225
* @param FilterInterface $filter
217226
* @param string $query
218227
* @param Attribute $attribute
219228
* @return string
229+
* @throws \Exception
220230
*/
221231
private function processRangeNumeric(FilterInterface $filter, $query, $attribute)
222232
{
@@ -238,14 +248,17 @@ private function processRangeNumeric(FilterInterface $filter, $query, $attribute
238248
->where('main_table.store_id = ?', $currentStoreId)
239249
->having($query);
240250

241-
$resultQuery = 'search_index.entity_id IN (
242-
select entity_id from ' . $this->conditionManager->wrapBrackets($select) . ' as filter
243-
)';
251+
$resultQuery = 'search_index.entity_id IN ('
252+
. 'select entity_id from '
253+
. $this->conditionManager->wrapBrackets($select)
254+
. ' as filter)';
244255

245256
return $resultQuery;
246257
}
247258

248259
/**
260+
* Process term select.
261+
*
249262
* @param FilterInterface $filter
250263
* @param bool $isNegation
251264
* @return string

0 commit comments

Comments
 (0)