コード例 #1
0
ファイル: JoinTrait.php プロジェクト: packaged/querybuilder
 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;
 }
コード例 #2
0
 public function assembleJoinClause(JoinClause $clause)
 {
     $segments = [];
     $source = $clause->getSource();
     $destination = $clause->getDestination();
     if ($source !== null && $destination !== null) {
         $segments[] = $this->assembleSegment($source) . ' = ' . $this->assembleSegment($destination);
     }
     if ($clause->hasPredicates()) {
         $segments = array_merge($segments, $this->assembleSegments($clause->getPredicates()));
     }
     return $clause->getAction() . ' ' . $this->assembleSegment($clause->getTable()) . ' ON ' . implode($clause->getGlue(), $segments);
 }