File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -333,6 +333,43 @@ public function applyFilterSelect(Filter\FilterSelect $filter)
333333 }
334334 }
335335
336+ /**
337+ * Filter by multiselect value
338+ * @param Filter\FilterMultiSelect $filter
339+ * @return void
340+ */
341+ public function applyFilterMultiSelect (Filter \FilterMultiSelect $ filter )
342+ {
343+ $ or = [];
344+ $ args = [];
345+ $ big_or = [];
346+ $ big_or_args = [];
347+ $ condition = $ filter ->getCondition ();
348+ foreach ($ condition as $ column => $ values ) {
349+ $ queryPart = '( ' ;
350+ foreach ($ values as $ value ) {
351+ $ queryPart .= "$ column = ? OR " ;
352+ $ args [] = $ value ;
353+ }
354+ $ queryPart = substr ($ queryPart , 0 , strlen ($ queryPart ) - 4 ).') ' ;
355+ $ or [] = $ queryPart ;
356+ $ big_or .= "$ queryPart OR " ;
357+ $ big_or_args = array_merge ($ big_or_args , $ args );
358+ }
359+
360+ if (sizeof ($ or ) > 1 ) {
361+ $ or = substr ($ big_or , 0 , strlen ($ big_or ) - 4 ).') ' ;
362+ $ args = $ big_or_args ;
363+ } else {
364+ $ or = reset ($ or );
365+ }
366+
367+ $ this ->sql = $ this ->queryHelper ->whereSql ($ or );
368+
369+ foreach ($ args as $ arg ) {
370+ $ this ->query_parameters [] = $ arg ;
371+ }
372+ }
336373
337374 /**
338375 * Apply limit and offet on data
You can’t perform that action at this time.
0 commit comments