Skip to content

Commit 9f51c3e

Browse files
Richard Snijdersdbu
Richard Snijders
authored andcommitted
Add the potential possibility of using nested joins
1 parent 3d9dbc8 commit 9f51c3e

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/PHPCR/Util/QOM/Sql2ToQomQueryConverter.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use PHPCR\Query\QOM\SameNodeJoinConditionInterface;
2525
use PHPCR\Query\QOM\SourceInterface;
2626
use PHPCR\Query\QOM\StaticOperandInterface;
27+
use Jackalope\Query\QOM\Selector;
2728
use PHPCR\Util\ValueConverter;
2829

2930
/**
@@ -141,11 +142,13 @@ protected function parseSource()
141142
$selector = $this->parseSelector();
142143

143144
$next = $this->scanner->lookupNextToken();
144-
if (in_array(strtoupper($next), array('JOIN', 'INNER', 'RIGHT', 'LEFT'))) {
145-
return $this->parseJoin($selector);
145+
$left = $selector;
146+
while (in_array(strtoupper($next), array('JOIN', 'INNER', 'RIGHT', 'LEFT'))) {
147+
$left = $this->parseJoin($left);
148+
$next = $this->scanner->lookupNextToken();
146149
}
147150

148-
return $selector;
151+
return $left;
149152
}
150153

151154
/**

0 commit comments

Comments
 (0)