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
1 changed files with 2 additions and 3 deletions

View File

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