File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed
app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/ConditionProcessor Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change 10
10
use Magento \Framework \Api \SearchCriteria \CollectionProcessor \ConditionProcessor \CustomConditionInterface ;
11
11
use Magento \Catalog \Model \ResourceModel \Product \Collection ;
12
12
use Magento \Framework \Api \Filter ;
13
- use Magento \Framework \Data \Collection \AbstractDb ;
14
13
use Magento \Framework \Exception \NoSuchEntityException as CategoryDoesNotExistException ;
15
14
16
15
/**
@@ -63,12 +62,12 @@ public function build(Filter $filter): string
63
62
)->where (
64
63
$ this ->resourceConnection ->getConnection ()->prepareSqlCondition (
65
64
'cat.category_id ' ,
66
- [$ this -> mapConditionType ( $ filter -> getConditionType ()) => $ this ->getCategoryIds ($ filter )]
65
+ [' in ' => $ this ->getCategoryIds ($ filter )]
67
66
)
68
67
);
69
68
70
69
$ selectCondition = [
71
- ' in ' => $ categorySelect
70
+ $ this -> mapConditionType ( $ filter -> getConditionType ()) => $ categorySelect
72
71
];
73
72
74
73
return $ this ->resourceConnection ->getConnection ()
@@ -116,12 +115,7 @@ private function getCategoryIds(Filter $filter): array
116
115
*/
117
116
private function mapConditionType (string $ conditionType ): string
118
117
{
119
- $ conditionsMap = [
120
- 'eq ' => 'in ' ,
121
- 'neq ' => 'nin ' ,
122
- 'like ' => 'in ' ,
123
- 'nlike ' => 'nin ' ,
124
- ];
125
- return $ conditionsMap [$ conditionType ] ?? $ conditionType ;
118
+ $ ninConditions = ['nin ' , 'neq ' , 'nlike ' ];
119
+ return in_array ($ conditionType , $ ninConditions , true ) ? 'nin ' : 'in ' ;
126
120
}
127
121
}
You can’t perform that action at this time.
0 commit comments