Example #1
0
 public function joinWithPredicates($table, ...$predicates)
 {
     if (empty($predicates)) {
         throw new \RuntimeException('No predicates specified for join');
     }
     $join = new JoinClause();
     $join->setTableName($table);
     $join->setPredicates(WhereClause::buildPredicates($predicates, $table));
     $this->addClause($join);
     return $this;
 }
Example #2
0
 private function _getNewSet(...$expressions)
 {
     $newPredicates = WhereClause::buildPredicates($expressions);
     if (count($newPredicates) === 1) {
         $newSet = Arrays::first($newPredicates);
     } else {
         $newSet = new PredicateSet();
         $newSet->setPredicates($newPredicates);
     }
     return $newSet;
 }
 /**
  * @param $input
  * @param $expect
  *
  * @dataProvider predicateData
  */
 public function testBuildPredicates($input, $expect)
 {
     $this->assertEquals($expect, WhereClause::buildPredicates($input));
 }