src/Utility/Validator.php
public static function validateData(RepositoryInterface $table, array $data, array $user): array
    {
        $fields = Utility::instance()->getSearchableFields($table, $user);
        $fields = array_keys($fields);

        // merge default options
        $data += Options::getDefaults($table);

        if (!empty($data['criteria'])) {
            $data['criteria'] = static::validateCriteria($data['criteria'], $fields);
        }

        $data['display_columns'] = static::validateDisplayColumns($data['display_columns'], $fields);
        $data['sort_by_field'] = static::validateSortByField(
            $data['sort_by_field'],
            $fields,
            $data['display_columns'],
            $table
        );
        $data['sort_by_order'] = static::validateSortByOrder($data['sort_by_order']);
        $data['aggregator'] = static::validateAggregator($data['aggregator']);

        return $data;
    }
public static function validateData(RepositoryInterface $table, array $data, array $user): array
    {
        $fields = Utility::instance()->getSearchableFields($table, $user);
        $fields = array_keys($fields);

        // merge default options
        $data += Options::getDefaults($table);

        if (!empty($data['criteria'])) {
            $data['criteria'] = static::validateCriteria($data['criteria'], $fields);
        }

        $data['display_columns'] = static::validateDisplayColumns($data['display_columns'], $fields);
        $data['sort_by_field'] = static::validateSortByField(
            $data['sort_by_field'],
            $fields,
            $data['display_columns'],
            $table
        );
        $data['sort_by_order'] = static::validateSortByOrder($data['sort_by_order']);
        $data['aggregator'] = static::validateAggregator($data['aggregator']);

        return $data;
    }
public static function validateData ( RepositoryInterface $ table , array $ data , array $ user ) : array { $ fields = Utility :: instance ( ) -> getSearchableFields ( $ table , $ user ) ; $ fields = array_keys ( $ fields ) ; // merge default options $ data += Options :: getDefaults ( $ table ) ; if ( ! empty ( $ data [ 'criteria' ] ) ) { $ data [ 'criteria' ] = static :: validateCriteria ( $ data [ 'criteria' ] , $ fields ) ; } $ data [ 'display_columns' ] = static :: validateDisplayColumns ( $ data [ 'display_columns' ] , $ fields ) ; $ data [ 'sort_by_field' ] = static :: validateSortByField ( $ data [ 'sort_by_field' ] , $ fields , $ data [ 'display_columns' ] , $ table ) ; $ data [ 'sort_by_order' ] = static :: validateSortByOrder ( $ data [ 'sort_by_order' ] ) ; $ data [ 'aggregator' ] = static :: validateAggregator ( $ data [ 'aggregator' ] ) ; return $ data ; }
Base search data validation method.

Retrieves current searchable table columns, validates and filters criteria, display columns
and sort by field against them. Then validates sort by order againt available options
and sets it to the default option if they fail validation.

@param \Cake\Datasource\RepositoryInterface $table Table instace
@param mixed[] $data Search data
@param mixed[] $user User info
@return mixed[]
Base search data validation method .