Doctrine 1.2.4
Doctrine_Query_From Class Reference

Inherits Doctrine_Query_Part.

Public Member Functions

 getQuery ()
 
 parse ($str, $return=false)
 

Detailed Description

Definition at line 33 of file From.php.

Member Function Documentation

Doctrine_Query_Part::getQuery ( )
inherited
Returns
Doctrine_Query $query the query object associated with this parser

Definition at line 58 of file Part.php.

{
return $this->query;
}
Doctrine_Query_From::parse (   $str,
  $return = false 
)

DQL FROM PARSER parses the FROM part of the query string

Parameters
string$str
boolean$returnif to return the parsed FROM and skip load()
Returns
void

Definition at line 43 of file From.php.

{
$str = trim($str);
$parts = $this->_tokenizer->bracketExplode($str, 'JOIN ');
$from = $return ? array() : null;
$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);
}
if ($return) {
$from[] = $e;
} else {
$table = $this->query->load(implode(' ', $e));
}
}
$operator = ($last == 'INNER') ? ':' : '.';
}
return $from;
}

The documentation for this class was generated from the following file: