lib/Sirel/Visitor/ToSql.php
protected function visitSirelNodeSelectStatement(Node\SelectStatement $select)
    {
        return join(" ", array_filter(array(
            "SELECT",

            ($select->distinct ? "DISTINCT" : null),

            ($select->projections
                ? join(", ", $this->visitEach($select->projections))
                : '*'),

            // FROM
            $this->visit($select->source),

            // WHERE
            ($select->restrictions 
                ? "WHERE " . join(" AND ", $this->visitEach($select->restrictions))
                : null
            ),

            // ORDER BY
            ($select->orders
                ? "ORDER BY " . join(", ", $this->visitEach($select->orders))
                : null),

            // GROUP BY
            ($select->groups
                ? "GROUP BY " . join(', ', $this->visitEach($select->groups))
                : null),

            // LIMIT
            ($select->limit ? $this->visit($select->limit) : null),

            // OFFSET 
            ($select->offset ? $this->visit($select->offset) : null)
        ))) . ';';
    }
protected function visitSirelNodeSelectStatement(Node\SelectStatement $select)
    {
        return join(" ", array_filter(array(
            "SELECT",

            ($select->distinct ? "DISTINCT" : null),

            ($select->projections
                ? join(", ", $this->visitEach($select->projections))
                : '*'),

            // FROM
            $this->visit($select->source),

            // WHERE
            ($select->restrictions 
                ? "WHERE " . join(" AND ", $this->visitEach($select->restrictions))
                : null
            ),

            // ORDER BY
            ($select->orders
                ? "ORDER BY " . join(", ", $this->visitEach($select->orders))
                : null),

            // GROUP BY
            ($select->groups
                ? "GROUP BY " . join(', ', $this->visitEach($select->groups))
                : null),

            // LIMIT
            ($select->limit ? $this->visit($select->limit) : null),

            // OFFSET 
            ($select->offset ? $this->visit($select->offset) : null)
        ))) . ';';
    }
protected function visitSirelNodeSelectStatement ( Node \ SelectStatement $ select ) { return join ( " " , array_filter ( array ( "SELECT" , ( $ select -> distinct ? "DISTINCT" : null ) , ( $ select -> projections ? join ( ", " , $ this -> visitEach ( $ select -> projections ) ) : '*' ) , // FROM $ this -> visit ( $ select -> source ) , // WHERE ( $ select -> restrictions ? "WHERE " . join ( " AND " , $ this -> visitEach ( $ select -> restrictions ) ) : null ) , // ORDER BY ( $ select -> orders ? "ORDER BY " . join ( ", " , $ this -> visitEach ( $ select -> orders ) ) : null ) , // GROUP BY ( $ select -> groups ? "GROUP BY " . join ( ', ' , $ this -> visitEach ( $ select -> groups ) ) : null ) , // LIMIT ( $ select -> limit ? $ this -> visit ( $ select -> limit ) : null ) , // OFFSET  ( $ select -> offset ? $ this -> visit ( $ select -> offset ) : null ) ) ) ) . ';' ; }
Get a SELECT Query

@param  Node\SelectStatement $select
@return string
Get a SELECT Query