src/Model/Behavior/SearchableBehavior.php
public function findSearch(Query $query, array $options) : Query
    {
        $search = new Search($query, $this->getTable());

        $search->setConjunction(Hash::get($options, 'conjunction', Search::DEFAULT_CONJUNCTION));

        foreach (Hash::get($options, 'data', []) as $criteria) {
            if (! is_array($criteria)) {
                throw new \InvalidArgumentException(sprintf(
                    'Search criteria must be an array, %s provided instead',
                    gettype($criteria)
                ));
            }

            $search->addCriteria(new Criteria($criteria));
        }

        return $search->execute();
    }
public function findSearch(Query $query, array $options) : Query
    {
        $search = new Search($query, $this->getTable());

        $search->setConjunction(Hash::get($options, 'conjunction', Search::DEFAULT_CONJUNCTION));

        foreach (Hash::get($options, 'data', []) as $criteria) {
            if (! is_array($criteria)) {
                throw new \InvalidArgumentException(sprintf(
                    'Search criteria must be an array, %s provided instead',
                    gettype($criteria)
                ));
            }

            $search->addCriteria(new Criteria($criteria));
        }

        return $search->execute();
    }
public function findSearch ( Query $ query , array $ options ) : Query { $ search = new Search ( $ query , $ this -> getTable ( ) ) ; $ search -> setConjunction ( Hash :: get ( $ options , 'conjunction' , Search :: DEFAULT_CONJUNCTION ) ) ; foreach ( Hash :: get ( $ options , 'data' , [ ] ) as $ criteria ) { if ( ! is_array ( $ criteria ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Search criteria must be an array, %s provided instead' , gettype ( $ criteria ) ) ) ; } $ search -> addCriteria ( new Criteria ( $ criteria ) ) ; } return $ search -> execute ( ) ; }
Search finder method.

@param \Cake\ORM\Query $query The query object to apply the finder options to
@param mixed[] $options List of options to pass to the finder
@return \Cake\ORM\Query
Search finder method .