From.php 704 Bytes
Newer Older
doctrine's avatar
doctrine committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
<?php
require_once("Part.php");

class Doctrine_Query_From extends Doctrine_Query_Part {

    /**
     * DQL FROM PARSER
     * parses the from part of the query string

     * @param string $str
     * @return void
     */
    final public function parse($str) {
        foreach(Doctrine_Query::bracketExplode(trim($str),",", "(",")") as $reference) {
            $reference = trim($reference);
            $a         = explode(".",$reference);
            $field     = array_pop($a);
            $table     = $this->query->load($reference);
        }
    }

    public function __toString() {
        return ( ! empty($this->parts))?implode(", ", $this->parts):'';
    }
}
?>