. */ Doctrine::autoload("Doctrine_Query_Part"); /** * Doctrine_Query_From * * @package Doctrine * @subpackage Query * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @link www.phpdoctrine.org * @since 1.0 * @version $Revision$ * @author Konsta Vesterinen */ class Doctrine_Query_From extends Doctrine_Query_Part { /** * DQL FROM PARSER * parses the FROM part of the query string * * @param string $str * @return void */ public function parse($str) { $str = trim($str); $parts = $this->_tokenizer->bracketExplode($str, 'JOIN'); $operator = false; switch (trim($parts[0])) { case 'INNER': $operator = ':'; case 'LEFT': array_shift($parts); break; } $last = ''; foreach ($parts as $k => $part) { $part = trim($part); if (empty($part)) { continue; } $e = explode(' ', $part); if (end($e) == 'INNER' || end($e) == 'LEFT') { $last = array_pop($e); } $part = implode(' ', $e); foreach ($this->_tokenizer->bracketExplode($part, ',') as $reference) { $reference = trim($reference); $e = explode(' ', $reference); $e2 = explode('.', $e[0]); if ($operator) { $e[0] = array_shift($e2) . $operator . implode('.', $e2); } $table = $this->query->load(implode(' ', $e)); } $operator = ($last == 'INNER') ? ':' : '.'; } return null; } }