Esempio n. 1
0
 public function testCompositeeConstructor()
 {
     $j = new Join(array('foo1', 'foo2'), array('bar1', 'bar2'), 'LEFT JOIN');
     $expect = array(array('left' => 'foo1', 'operator' => '=', 'right' => 'bar1'), array('left' => 'foo2', 'operator' => '=', 'right' => 'bar2'));
     $this->assertEquals($expect, $j->getConditions());
     $this->assertEquals('LEFT JOIN', $j->getJoinType());
 }
Esempio n. 2
0
 /**
  * @param Join $join
  * @return bool
  */
 public function equals($join)
 {
     return $join !== null && $join instanceof Join && $this->joinType == $join->getJoinType() && $this->getConditions() == $join->getConditions();
 }
Esempio n. 3
0
 /**
  * @param Join $join
  *
  * @return bool
  */
 public function equals($join)
 {
     $parametersOfThisClauses = array();
     $parametersOfJoinClauses = array();
     return $join !== null && $join instanceof Join && $this->getJoinType() == $join->getJoinType() && $this->getConditions() == $join->getConditions() && $this->getClause($parametersOfThisClauses) == $join->getClause($parametersOfJoinClauses);
 }
Esempio n. 4
0
 protected function joinConditions(Join $join)
 {
     $sqls = [];
     $i = 0;
     foreach ($join->getConditions() as $condition) {
         $sql = $this->{$condition['type']}($condition);
         if ($i++ > 0) {
             $sql = $condition['separator'] . ' ' . $sql;
         }
     }
     return implode(' ', $sqls);
 }