private function buildQueryTerm()
 {
     if (!$this->conditionBuilder) {
         return $this->query;
     }
     $compiler = new QueryPredicateVisitor();
     $this->conditionBuilder->endAllGroups();
     $this->conditionBuilder->andWhere($this->query);
     return $compiler->compile($this->conditionBuilder->getPredicate());
 }
 private function assertQuery($expected, PredicateBuilder $builder)
 {
     $compiler = new QueryPredicateVisitor();
     $this->assertEquals($expected, $compiler->compile($builder->getPredicate()));
 }