src/Utility/Search.php
public function prepareData(ServerRequest $request): array
    {
        $result = $request->getData();

        $event = new Event((string)EventName::MODEL_SEARCH_CHILD_ITEMS(), $this, [
            'criteria' => $result
        ]);
        EventManager::instance()->dispatch($event);

        $result = $event->result ? $event->result : $result;

        $value = Hash::get($result, 'criteria.query');

        // advanced search
        if (!$value) {
            return $result;
        }

        // basic search query, converted to search criteria
        $result['aggregator'] = 'OR';
        $basicSearch = new BasicSearch($this->table, $this->user);
        $result['criteria'] = $basicSearch->getCriteria($value);

        return $result;
    }
public function prepareData(ServerRequest $request): array
    {
        $result = $request->getData();

        $event = new Event((string)EventName::MODEL_SEARCH_CHILD_ITEMS(), $this, [
            'criteria' => $result
        ]);
        EventManager::instance()->dispatch($event);

        $result = $event->result ? $event->result : $result;

        $value = Hash::get($result, 'criteria.query');

        // advanced search
        if (!$value) {
            return $result;
        }

        // basic search query, converted to search criteria
        $result['aggregator'] = 'OR';
        $basicSearch = new BasicSearch($this->table, $this->user);
        $result['criteria'] = $basicSearch->getCriteria($value);

        return $result;
    }
public function prepareData ( ServerRequest $ request ) : array { $ result = $ request -> getData ( ) ; $ event = new Event ( ( string ) EventName :: MODEL_SEARCH_CHILD_ITEMS ( ) , $ this , [ 'criteria' => $ result ] ) ; EventManager :: instance ( ) -> dispatch ( $ event ) ; $ result = $ event -> result ? $ event -> result : $ result ; $ value = Hash :: get ( $ result , 'criteria.query' ) ; // advanced search if ( ! $ value ) { return $ result ; } // basic search query, converted to search criteria $ result [ 'aggregator' ] = 'OR' ; $ basicSearch = new BasicSearch ( $ this -> table , $ this -> user ) ; $ result [ 'criteria' ] = $ basicSearch -> getCriteria ( $ value ) ; return $ result ; }
Prepare search data from request data.

@param \Cake\Http\ServerRequest $request Request object
@return mixed[]
Prepare search data from request data .