public function search(array $search, $sort, $select = null)
    {
        $select = ($select) ?: $this->getSelect();

        foreach ($search as $key => $value) {
            if (!$value['searchString'] == '') {
                if (substr($value['searchString'], 0, 1) == '=' && $key == 0) {
                    $id = (int)substr($value['searchString'], 1);
                    $select->where->equalTo($this->getPrimaryKey(), $id);
                } else {
                    $where = $select->where->nest();
                    $c = 0;

                    foreach ($value['columns'] as $column) {
                        if ($c > 0) $where->or;
                        $where->like($column, '%' . $value['searchString'] . '%');
                        $c++;
                    }

                    $where->unnest();
                }
            }
        }

        $select = $this->setSortOrder($select, $sort);

        return $this->fetchResult($select);
    }
public function search(array $search, $sort, $select = null)
    {
        $select = ($select) ?: $this->getSelect();

        foreach ($search as $key => $value) {
            if (!$value['searchString'] == '') {
                if (substr($value['searchString'], 0, 1) == '=' && $key == 0) {
                    $id = (int)substr($value['searchString'], 1);
                    $select->where->equalTo($this->getPrimaryKey(), $id);
                } else {
                    $where = $select->where->nest();
                    $c = 0;

                    foreach ($value['columns'] as $column) {
                        if ($c > 0) $where->or;
                        $where->like($column, '%' . $value['searchString'] . '%');
                        $c++;
                    }

                    $where->unnest();
                }
            }
        }

        $select = $this->setSortOrder($select, $sort);

        return $this->fetchResult($select);
    }
public function search ( array $ search , $ sort , $ select = null ) { $ select = ( $ select ) ? : $ this -> getSelect ( ) ; foreach ( $ search as $ key => $ value ) { if ( ! $ value [ 'searchString' ] == '' ) { if ( substr ( $ value [ 'searchString' ] , 0 , 1 ) == '=' && $ key == 0 ) { $ id = ( int ) substr ( $ value [ 'searchString' ] , 1 ) ; $ select -> where -> equalTo ( $ this -> getPrimaryKey ( ) , $ id ) ; } else { $ where = $ select -> where -> nest ( ) ; $ c = 0 ; foreach ( $ value [ 'columns' ] as $ column ) { if ( $ c > 0 ) $ where -> or ; $ where -> like ( $ column , '%' . $ value [ 'searchString' ] . '%' ) ; $ c ++ ; } $ where -> unnest ( ) ; } } } $ select = $ this -> setSortOrder ( $ select , $ sort ) ; return $ this -> fetchResult ( $ select ) ; }
basic search on table data

@param array $search
@param string $sort
@param Select $select
@return \Zend\Db\ResultSet\ResultSet|Paginator|HydratingResultSet
basic search on table data