protected function addQuickSearchConditions(\yii\db\ActiveQuery $query)
    {
        if (!$query instanceof ActiveQuery) {
            return $query;
        }
        $parts = explode(ActiveSearchInterface::TOKEN_SEPARATOR, $query->quickSearchPhrase);
        $searchPhrase = array_filter(array_map('trim', $parts));
        if (count($searchPhrase) === 2 && (string)intval($searchPhrase[0]) === $searchPhrase[0]
            && (string)intval($searchPhrase[1]) === $searchPhrase[1]
        ) {
            // special case, whole term is just one digit with decimal separator
            $searchPhrase = [trim($query->quickSearchPhrase)];
        } elseif (count($parts) > 1) {
            // add the original value for an exact match
            $searchPhrase[] = trim($query->quickSearchPhrase);
        }
        list ($safeAttributes, $relationAttributes) = $this->getQuickSearchAttributes();
        $conditions = ['or'];
        foreach ($searchPhrase as $word) {
            if (($condition = $this->processSearchToken($word, $safeAttributes)) !== null) {
                $conditions[] = $condition;
            }
        }
        if (($condition = $this->processSearchRelated($query, $searchPhrase, $relationAttributes)) !== null) {
            $conditions[] = $condition;
        }
        if ($conditions !== ['or']) {
            $query->andWhere($conditions);
        }
        return $query;
    }
protected function addQuickSearchConditions(\yii\db\ActiveQuery $query)
    {
        if (!$query instanceof ActiveQuery) {
            return $query;
        }
        $parts = explode(ActiveSearchInterface::TOKEN_SEPARATOR, $query->quickSearchPhrase);
        $searchPhrase = array_filter(array_map('trim', $parts));
        if (count($searchPhrase) === 2 && (string)intval($searchPhrase[0]) === $searchPhrase[0]
            && (string)intval($searchPhrase[1]) === $searchPhrase[1]
        ) {
            // special case, whole term is just one digit with decimal separator
            $searchPhrase = [trim($query->quickSearchPhrase)];
        } elseif (count($parts) > 1) {
            // add the original value for an exact match
            $searchPhrase[] = trim($query->quickSearchPhrase);
        }
        list ($safeAttributes, $relationAttributes) = $this->getQuickSearchAttributes();
        $conditions = ['or'];
        foreach ($searchPhrase as $word) {
            if (($condition = $this->processSearchToken($word, $safeAttributes)) !== null) {
                $conditions[] = $condition;
            }
        }
        if (($condition = $this->processSearchRelated($query, $searchPhrase, $relationAttributes)) !== null) {
            $conditions[] = $condition;
        }
        if ($conditions !== ['or']) {
            $query->andWhere($conditions);
        }
        return $query;
    }
protected function addQuickSearchConditions ( \ yii \ db \ ActiveQuery $ query ) { if ( ! $ query instanceof ActiveQuery ) { return $ query ; } $ parts = explode ( ActiveSearchInterface :: TOKEN_SEPARATOR , $ query -> quickSearchPhrase ) ; $ searchPhrase = array_filter ( array_map ( 'trim' , $ parts ) ) ; if ( count ( $ searchPhrase ) === 2 && ( string ) intval ( $ searchPhrase [ 0 ] ) === $ searchPhrase [ 0 ] && ( string ) intval ( $ searchPhrase [ 1 ] ) === $ searchPhrase [ 1 ] ) { // special case, whole term is just one digit with decimal separator $ searchPhrase = [ trim ( $ query -> quickSearchPhrase ) ] ; } elseif ( count ( $ parts ) > 1 ) { // add the original value for an exact match $ searchPhrase [ ] = trim ( $ query -> quickSearchPhrase ) ; } list ( $ safeAttributes , $ relationAttributes ) = $ this -> getQuickSearchAttributes ( ) ; $ conditions = [ 'or' ] ; foreach ( $ searchPhrase as $ word ) { if ( ( $ condition = $ this -> processSearchToken ( $ word , $ safeAttributes ) ) !== null ) { $ conditions [ ] = $ condition ; } } if ( ( $ condition = $ this -> processSearchRelated ( $ query , $ searchPhrase , $ relationAttributes ) ) !== null ) { $ conditions [ ] = $ condition ; } if ( $ conditions !== [ 'or' ] ) { $ query -> andWhere ( $ conditions ) ; } return $ query ; }
Use one value to compare against all columns.
@param \yii\db\ActiveQuery $query
@return \yii\db\ActiveQuery
Use one value to compare against all columns .