Hello, if you are working on cakephp and you need the joins with find method here is an example. Here $my_joins is and array having multiple join cases in other different arrays inside it.
$my_joins=array(
'joins' =>
array(
array(
'table' => 'purchases',
'alias' => 'Purchase',
'type' => 'left',
'conditions'=> array('Deal.id = Purchase.deal_id')
)
)
);
$find_coupons = $this->Coupon->find('all', $my_joins);
'foreignKey' => false,
'conditions'=> array('Purchase.id = Coupon.purchase_id')
),
array(
'table' => 'deals',
'alias' => 'Deal',
'type' => 'left',
'foreignKey' => false,
'conditions'=> array('Deal.id = Purchase.deal_id')
)
)
);
$find_coupons = $this->Coupon->find('all', $my_joins);
This can added more inside $my_joins as equal to number of tables you want to compare.
And in the last you can find method using 'all' over array $my_joins and you'll get the results
0 Comment(s)