Join Composite Method

join_composite method purpose is for joining the table with multiple primary key.

We can achieved the conditions of joining multiple primary key with composite_create method.

class Blog_Model extends SENE_Model{
	var $tbl = 'd_order';
	var $tbl_as = 'dor';
var $tbl2 = 'b_seller';
var $tbl2_as = 'bs';
	public function __construct(){
		parent::__construct();
		$this->db->from($this->tbl,$this->tbl_as);
	}
  private function __joinTbl2(){
    $composites = array();
    $composites[] = $this->db->composite_create("$this->tbl_as.nation_code","=","$this->tbl_as.nation_code");
    $composites[] = $this->db->composite_create("$this->tbl_as.b_seller_id","=","$this->tbl_as.id");
    return $composites;
  }
  public function getByOrderId($id){
    $this->db->join_composite($this->tbl2,$this->tbl2_as,$this->__joinTbl2(),"inner");
    $this->db->where_as("$this->tbl_as.id",$this->db->esc($id));
    return $this->db->get_first();
  }
}
					

Parameters

join_composite method has 3 required parameters and will returned join composite object

Table Name 1

The table for joined with current table.

Alias of Table Name 1

The alias table for joined with current table.

Array of Join Composite Object

Value required from array of object from composite_create.

Join Method

Join method value. Default empty string. Value consist of, inner, outer, left, right.

Relational Operator