public function toSQL(WhereTree $data = null)
    {
        if ($data === null) {
            $data = $this->data;
        }
        $res = '';
        foreach ($data->getChilds() as $v) {
            /* @var $v WhereTree */
            if ($v->getChilds()) {
                $res .= '(' . $this->toSQL($v) . ')';
            } elseif ($v->getValue() instanceof SQLExpressionParser) {
                $res .= $v->getValue()->toSQL();
            } else {
                $res .= ' ' . $v->getValue() . ' ';
            }
        }
        return $res . '';
    }
public function toSQL(WhereTree $data = null)
    {
        if ($data === null) {
            $data = $this->data;
        }
        $res = '';
        foreach ($data->getChilds() as $v) {
            /* @var $v WhereTree */
            if ($v->getChilds()) {
                $res .= '(' . $this->toSQL($v) . ')';
            } elseif ($v->getValue() instanceof SQLExpressionParser) {
                $res .= $v->getValue()->toSQL();
            } else {
                $res .= ' ' . $v->getValue() . ' ';
            }
        }
        return $res . '';
    }
public function toSQL ( WhereTree $ data = null ) { if ( $ data === null ) { $ data = $ this -> data ; } $ res = '' ; foreach ( $ data -> getChilds ( ) as $ v ) { /* @var $v WhereTree */ if ( $ v -> getChilds ( ) ) { $ res .= '(' . $ this -> toSQL ( $ v ) . ')' ; } elseif ( $ v -> getValue ( ) instanceof SQLExpressionParser ) { $ res .= $ v -> getValue ( ) -> toSQL ( ) ; } else { $ res .= ' ' . $ v -> getValue ( ) . ' ' ; } } return $ res . '' ; }
Converts object to SQL-expression
@param WhereTree $data Internal data, use without it
@return string SQL string
Converts object to SQL - expression