Fix that the TreeToSqlParser cannot handle partial conjunction nodes

This commit is contained in:
Johannes Meyer 2014-03-18 09:00:16 +01:00
parent e355415164
commit 1604f4728b

View File

@ -112,15 +112,14 @@ class TreeToSqlParser
private function parseConjunctionNode(Node $node) private function parseConjunctionNode(Node $node)
{ {
$queryString = ''; $queryString = '';
$leftQuery = $this->nodeToSqlQuery($node->left); $leftQuery = $node->left !== null ? $this->nodeToSqlQuery($node->left) : '';
$rightQuery = $this->nodeToSqlQuery($node->right); $rightQuery = $node->right !== null ? $this->nodeToSqlQuery($node->right) : '';
if ($leftQuery != '') { if ($leftQuery != '') {
$queryString .= $leftQuery . ' '; $queryString .= $leftQuery . ' ';
} }
if ($rightQuery != '') { if ($rightQuery != '') {
$queryString .= (($queryString !== '') ? $node->type . ' ' : ' ') . $rightQuery; $queryString .= (($queryString !== '') ? $node->type . ' ' : ' ') . $rightQuery;
} }
return $queryString; return $queryString;