@@ -105,6 +105,10 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
105
105
$ collection ->setEntityTypeFilter ($ this ->eavConfig ->getEntityType ($ entityTypeCode )->getId ());
106
106
}
107
107
108
+ foreach ($ searchCriteria ->getFilterGroups () as $ group ) {
109
+ $ this ->addFilterGroupToCollection ($ group , $ collection );
110
+ }
111
+
108
112
$ collection ->setCurPage ($ searchCriteria ->getCurrentPage ());
109
113
$ collection ->setPageSize ($ searchCriteria ->getPageSize ());
110
114
@@ -115,6 +119,29 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCr
115
119
return $ searchResults ;
116
120
}
117
121
122
+ /**
123
+ * Helper function that adds a FilterGroup to the collection.
124
+ *
125
+ * @deprecated already removed in 2.2-develop. Use CollectionProcessorInterface to process search criteria
126
+ *
127
+ * @param \Magento\Framework\Api\Search\FilterGroup $filterGroup
128
+ * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\Collection $collection
129
+ * @return void
130
+ */
131
+ protected function addFilterGroupToCollection (
132
+ \Magento \Framework \Api \Search \FilterGroup $ filterGroup ,
133
+ \Magento \Eav \Model \ResourceModel \Entity \Attribute \Set \Collection $ collection
134
+ ) {
135
+ foreach ($ filterGroup ->getFilters () as $ filter ) {
136
+ /** entity type filter is already set on collection */
137
+ if ($ filter ->getField () === 'entity_type_code ' ) {
138
+ continue ;
139
+ }
140
+ $ conditionType = $ filter ->getConditionType () ? $ filter ->getConditionType () : 'eq ' ;
141
+ $ collection ->addFieldToFilter ($ filter ->getField (), [$ conditionType , $ filter ->getValue ()]);
142
+ }
143
+ }
144
+
118
145
/**
119
146
* Retrieve entity type code from search criteria
120
147
*
0 commit comments