protected function getCriteria(Builder $builder, array $query)
    {
        $criteria = [];
        foreach ($query as $value) {
            $criterion = Criterion::make($value, $this->_getDefaultSortOrder());
            if ($this->isFieldSortable($builder, $criterion->getField())) {
                $criteria[] = $criterion;
            }
        }

        return $criteria;
    }
protected function getCriteria(Builder $builder, array $query)
    {
        $criteria = [];
        foreach ($query as $value) {
            $criterion = Criterion::make($value, $this->_getDefaultSortOrder());
            if ($this->isFieldSortable($builder, $criterion->getField())) {
                $criteria[] = $criterion;
            }
        }

        return $criteria;
    }
protected function getCriteria ( Builder $ builder , array $ query ) { $ criteria = [ ] ; foreach ( $ query as $ value ) { $ criterion = Criterion :: make ( $ value , $ this -> _getDefaultSortOrder ( ) ) ; if ( $ this -> isFieldSortable ( $ builder , $ criterion -> getField ( ) ) ) { $ criteria [ ] = $ criterion ; } } return $ criteria ; }
Builds sort criteria based on model's sortable fields and query parameters.

@param Builder $builder query builder
@param array $query query parameters

@return array
Builds sort criteria based on model s sortable fields and query parameters .