public function addFilterGroupToCollection(FilterGroup $filterGroup, Collection $collection)
    {
        $fields = [];
        $conditions = [];
        foreach ($filterGroup->getFilters() as $filter) {
            $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq';
            $fields[] = $filter->getField();
            $conditions[] = [$condition => $filter->getValue()];
        }
        if ($fields) {
            $collection->addFieldToFilter($fields, $conditions);
        }
        return $this;
    }
public function addFilterGroupToCollection(FilterGroup $filterGroup, Collection $collection)
    {
        $fields = [];
        $conditions = [];
        foreach ($filterGroup->getFilters() as $filter) {
            $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq';
            $fields[] = $filter->getField();
            $conditions[] = [$condition => $filter->getValue()];
        }
        if ($fields) {
            $collection->addFieldToFilter($fields, $conditions);
        }
        return $this;
    }
public function addFilterGroupToCollection ( FilterGroup $ filterGroup , Collection $ collection ) { $ fields = [ ] ; $ conditions = [ ] ; foreach ( $ filterGroup -> getFilters ( ) as $ filter ) { $ condition = $ filter -> getConditionType ( ) ? $ filter -> getConditionType ( ) : 'eq' ; $ fields [ ] = $ filter -> getField ( ) ; $ conditions [ ] = [ $ condition => $ filter -> getValue ( ) ] ; } if ( $ fields ) { $ collection -> addFieldToFilter ( $ fields , $ conditions ) ; } return $ this ; }
Helper function that adds a FilterGroup to the collection.

@param FilterGroup $filterGroup
@param Collection $collection
@return $this
@throws \Magento\Framework\Exception\InputException
Helper function that adds a FilterGroup to the collection .