public function build(ExpressionInterface $expression, array &$params = [])
    {
        $operator = $expression->getOperator();
        $column = $expression->getColumn();
        $values = $expression->getValues();

        if ($column === []) {
            // no columns to test against
            return $operator === 'IN' ? '0=1' : '';
        }

        if ($values instanceof Query) {
            return $this->buildSubqueryInCondition($operator, $column, $values, $params);
        }

        if (!is_array($values) && !$values instanceof \Traversable) {
            // ensure values is an array
            $values = (array) $values;
        }

        if (is_array($column)) {
            if (count($column) > 1) {
                return $this->buildCompositeInCondition($operator, $column, $values, $params);
            } else {
                $column = reset($column);
            }
        }

        if ($column instanceof \Traversable) {
            if (iterator_count($column) > 1) {
                return $this->buildCompositeInCondition($operator, $column, $values, $params);
            } else {
                $column->rewind();
                $column = $column->current();
            }
        }

        $sqlValues = $this->buildValues($expression, $values, $params);
        if (empty($sqlValues)) {
            return $operator === 'IN' ? '0=1' : '';
        }

        if (strpos($column, '(') === false) {
            $column = $this->queryBuilder->db->quoteColumnName($column);
        }
        if (count($sqlValues) > 1) {
            return "$column $operator (" . implode(', ', $sqlValues) . ')';
        }

        $operator = $operator === 'IN' ? '=' : '<>';

        return $column . $operator . reset($sqlValues);
    }
public function build(ExpressionInterface $expression, array &$params = [])
    {
        $operator = $expression->getOperator();
        $column = $expression->getColumn();
        $values = $expression->getValues();

        if ($column === []) {
            
            return $operator === 'IN' ? '0=1' : '';
        }

        if ($values instanceof Query) {
            return $this->buildSubqueryInCondition($operator, $column, $values, $params);
        }

        if (!is_array($values) && !$values instanceof \Traversable) {
            
            $values = (array) $values;
        }

        if (is_array($column)) {
            if (count($column) > 1) {
                return $this->buildCompositeInCondition($operator, $column, $values, $params);
            } else {
                $column = reset($column);
            }
        }

        if ($column instanceof \Traversable) {
            if (iterator_count($column) > 1) {
                return $this->buildCompositeInCondition($operator, $column, $values, $params);
            } else {
                $column->rewind();
                $column = $column->current();
            }
        }

        $sqlValues = $this->buildValues($expression, $values, $params);
        if (empty($sqlValues)) {
            return $operator === 'IN' ? '0=1' : '';
        }

        if (strpos($column, '(') === false) {
            $column = $this->queryBuilder->db->quoteColumnName($column);
        }
        if (count($sqlValues) > 1) {
            return "$column $operator (" . implode(', ', $sqlValues) . ')';
        }

        $operator = $operator === 'IN' ? '=' : '<>';

        return $column . $operator . reset($sqlValues);
    }
public function build ( ExpressionInterface $ expression , array & $ params = [ ] ) { $ operator = $ expression -> getOperator ( ) ; $ column = $ expression -> getColumn ( ) ; $ values = $ expression -> getValues ( ) ; if ( $ column === [ ] ) { // no columns to test against return $ operator === 'IN' ? '0=1' : '' ; } if ( $ values instanceof Query ) { return $ this -> buildSubqueryInCondition ( $ operator , $ column , $ values , $ params ) ; } if ( ! is_array ( $ values ) && ! $ values instanceof \ Traversable ) { // ensure values is an array $ values = ( array ) $ values ; } if ( is_array ( $ column ) ) { if ( count ( $ column ) > 1 ) { return $ this -> buildCompositeInCondition ( $ operator , $ column , $ values , $ params ) ; } else { $ column = reset ( $ column ) ; } } if ( $ column instanceof \ Traversable ) { if ( iterator_count ( $ column ) > 1 ) { return $ this -> buildCompositeInCondition ( $ operator , $ column , $ values , $ params ) ; } else { $ column -> rewind ( ) ; $ column = $ column -> current ( ) ; } } $ sqlValues = $ this -> buildValues ( $ expression , $ values , $ params ) ; if ( empty ( $ sqlValues ) ) { return $ operator === 'IN' ? '0=1' : '' ; } if ( strpos ( $ column , '(' ) === false ) { $ column = $ this -> queryBuilder -> db -> quoteColumnName ( $ column ) ; } if ( count ( $ sqlValues ) > 1 ) { return "$column $operator (" . implode ( ', ' , $ sqlValues ) . ')' ; } $ operator = $ operator === 'IN' ? '=' : '<>' ; return $ column . $ operator . reset ( $ sqlValues ) ; }
Method builds the raw SQL from the $expression that will not be additionally
escaped or quoted.

@param ExpressionInterface|InCondition $expression the expression to be built.
@param array $params the binding parameters.
@return string the raw SQL that will not be additionally escaped or quoted.
Method builds the raw SQL from the $expression that will not be additionally escaped or quoted .