Commit 1473df19 authored by zYne's avatar zYne

new DQL WHERE parser

parent b83321e5
...@@ -73,13 +73,14 @@ class Doctrine_Query_From extends Doctrine_Query_Part ...@@ -73,13 +73,14 @@ class Doctrine_Query_From extends Doctrine_Query_Part
foreach (Doctrine_Tokenizer::bracketExplode($part, ',') as $reference) { foreach (Doctrine_Tokenizer::bracketExplode($part, ',') as $reference) {
$reference = trim($reference); $reference = trim($reference);
$e = explode('.', $reference); $e = explode(' ', $reference);
$e2 = explode('.', $e[0]);
if ($operator) { if ($operator) {
$reference = array_shift($e) . $operator . implode('.', $e); $e[0] = array_shift($e2) . $operator . implode('.', $e2);
} }
$table = $this->query->load($reference); $table = $this->query->load(implode(' ', $e));
} }
$operator = ($last == 'INNER') ? ':' : '.'; $operator = ($last == 'INNER') ? ':' : '.';
......
...@@ -58,7 +58,7 @@ class Doctrine_Query_JoinCondition extends Doctrine_Query_Condition ...@@ -58,7 +58,7 @@ class Doctrine_Query_JoinCondition extends Doctrine_Query_Condition
if (substr($trimmed, 0, 4) == 'FROM' || substr($trimmed, 0, 6) == 'SELECT') { if (substr($trimmed, 0, 4) == 'FROM' || substr($trimmed, 0, 6) == 'SELECT') {
// subquery found // subquery found
$q = new Doctrine_Query(); $q = $this->query->createSubquery();
$value = '(' . $q->parseQuery($trimmed)->getQuery() . ')'; $value = '(' . $q->parseQuery($trimmed)->getQuery() . ')';
} elseif (substr($trimmed, 0, 4) == 'SQL:') { } elseif (substr($trimmed, 0, 4) == 'SQL:') {
$value = '(' . substr($trimmed, 4) . ')'; $value = '(' . substr($trimmed, 4) . ')';
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment