protected function search(ModelCriteria $query, Request $request)
    {
        $filters = $this->getFilters($request);

        if (empty($filters)) {
            return $query;
        }

        $conditions = array();

        $columns = $this->getSearchColumns($request);

        if (is_array($filters)) {
            foreach ($columns as $name => $condition) {
                $items = explode('.', $name);
                $i = 0;
                $values = $filters;

                while (is_array($values) && array_key_exists($items[$i], $values)) {
                    $values = $values[$items[$i]];
                    $i++;
                }

                if (is_array($values)) {
                    continue;
                } else {
                    $value = trim($values);
                }

                if (empty($value) && !is_numeric($value)) {
                    continue;
                }

                $query->condition(
                    'search_'.$name,
                    sprintf($condition, $value)
                );

                $conditions[] = 'search_'.$name;
            }

            if (!empty($conditions)) {
                return $query->where($conditions, 'and');
            }
        } else {
            $value = trim($filters);

            foreach ($columns as $name => $condition) {
                $query->condition(
                    'search_'.$name,
                    sprintf($condition, $value)
                );

                $conditions[] = 'search_'.$name;
            }

            if (!empty($conditions)) {
                return $query->where($conditions, 'or');
            }
        }
    }
protected function search(ModelCriteria $query, Request $request)
    {
        $filters = $this->getFilters($request);

        if (empty($filters)) {
            return $query;
        }

        $conditions = array();

        $columns = $this->getSearchColumns($request);

        if (is_array($filters)) {
            foreach ($columns as $name => $condition) {
                $items = explode('.', $name);
                $i = 0;
                $values = $filters;

                while (is_array($values) && array_key_exists($items[$i], $values)) {
                    $values = $values[$items[$i]];
                    $i++;
                }

                if (is_array($values)) {
                    continue;
                } else {
                    $value = trim($values);
                }

                if (empty($value) && !is_numeric($value)) {
                    continue;
                }

                $query->condition(
                    'search_'.$name,
                    sprintf($condition, $value)
                );

                $conditions[] = 'search_'.$name;
            }

            if (!empty($conditions)) {
                return $query->where($conditions, 'and');
            }
        } else {
            $value = trim($filters);

            foreach ($columns as $name => $condition) {
                $query->condition(
                    'search_'.$name,
                    sprintf($condition, $value)
                );

                $conditions[] = 'search_'.$name;
            }

            if (!empty($conditions)) {
                return $query->where($conditions, 'or');
            }
        }
    }
protected function search ( ModelCriteria $ query , Request $ request ) { $ filters = $ this -> getFilters ( $ request ) ; if ( empty ( $ filters ) ) { return $ query ; } $ conditions = array ( ) ; $ columns = $ this -> getSearchColumns ( $ request ) ; if ( is_array ( $ filters ) ) { foreach ( $ columns as $ name => $ condition ) { $ items = explode ( '.' , $ name ) ; $ i = 0 ; $ values = $ filters ; while ( is_array ( $ values ) && array_key_exists ( $ items [ $ i ] , $ values ) ) { $ values = $ values [ $ items [ $ i ] ] ; $ i ++ ; } if ( is_array ( $ values ) ) { continue ; } else { $ value = trim ( $ values ) ; } if ( empty ( $ value ) && ! is_numeric ( $ value ) ) { continue ; } $ query -> condition ( 'search_' . $ name , sprintf ( $ condition , $ value ) ) ; $ conditions [ ] = 'search_' . $ name ; } if ( ! empty ( $ conditions ) ) { return $ query -> where ( $ conditions , 'and' ) ; } } else { $ value = trim ( $ filters ) ; foreach ( $ columns as $ name => $ condition ) { $ query -> condition ( 'search_' . $ name , sprintf ( $ condition , $ value ) ) ; $ conditions [ ] = 'search_' . $ name ; } if ( ! empty ( $ conditions ) ) { return $ query -> where ( $ conditions , 'or' ) ; } } }
Filters the database records. This method should be considered final for
all practical purposes.

@param ModelCriteria $query the Propel query
@param Request $request the current request
Filters the database records . This method should be considered final for all practical purposes .