public function findSearch(QueryInterface $query, array $options)
    {
        if (!isset($options['search'])) {
            throw new Exception(
                'Custom finder "search" expects search arguments ' .
                'to be nested under key "search" in find() options.'
            );
        }

        $filters = $this->_getFilters(Hash::get($options, 'collection', Manager::DEFAULT_COLLECTION));

        $params = $this->_flattenParams((array)$options['search'], $filters);
        $params = $this->_extractParams($params, $filters);

        return $this->_processFilters($filters, $params, $query);
    }
public function findSearch(QueryInterface $query, array $options)
    {
        if (!isset($options['search'])) {
            throw new Exception(
                'Custom finder "search" expects search arguments ' .
                'to be nested under key "search" in find() options.'
            );
        }

        $filters = $this->_getFilters(Hash::get($options, 'collection', Manager::DEFAULT_COLLECTION));

        $params = $this->_flattenParams((array)$options['search'], $filters);
        $params = $this->_extractParams($params, $filters);

        return $this->_processFilters($filters, $params, $query);
    }
public function findSearch ( QueryInterface $ query , array $ options ) { if ( ! isset ( $ options [ 'search' ] ) ) { throw new Exception ( 'Custom finder "search" expects search arguments ' . 'to be nested under key "search" in find() options.' ) ; } $ filters = $ this -> _getFilters ( Hash :: get ( $ options , 'collection' , Manager :: DEFAULT_COLLECTION ) ) ; $ params = $ this -> _flattenParams ( ( array ) $ options [ 'search' ] , $ filters ) ; $ params = $ this -> _extractParams ( $ params , $ filters ) ; return $ this -> _processFilters ( $ filters , $ params , $ query ) ; }
Callback fired from the controller.

@param \Cake\Datasource\QueryInterface $query Query.
@param array $options The options for the find.
- `search`: Array of search arguments.
- `collection`: Filter collection name.
@return \Cake\Datasource\QueryInterface The Query object used in pagination.
@throws \Exception When missing search arguments.
Callback fired from the controller .