コード例 #1
0
 public function testCompileMultipleComposites()
 {
     $predicate = new LiteralPredicate('bacon');
     $predicate = $predicate->andPredicate(new LiteralPredicate('eggs'));
     $predicate = $predicate->orPredicate(new LiteralPredicate('steak'));
     $compiler = new QueryPredicateVisitor();
     $this->assertEquals('((bacon AND eggs) OR steak)', $compiler->compile($predicate));
     $predicate = new LiteralPredicate('bacon');
     $predicate = $predicate->orPredicate(new LiteralPredicate('eggs'));
     $predicate = $predicate->andPredicate(new LiteralPredicate('steak'));
     $this->assertEquals('((bacon OR eggs) AND steak)', $compiler->compile($predicate));
 }
コード例 #2
0
 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());
 }
コード例 #3
0
 private function assertQuery($expected, PredicateBuilder $builder)
 {
     $compiler = new QueryPredicateVisitor();
     $this->assertEquals($expected, $compiler->compile($builder->getPredicate()));
 }