複数テーブルからリレーション関係にある
カラム同士を紐付けて(INNER JOIN)クエリー実行。
$options = array(
'fields' => $val['fields'],
'conditions' => array(
'GrouponList.category_id' => $category_id,
),
'limit' => $val['limit'],
'order' => $val['order'],
'group' => $val['group'],
'joins' => array(
array(
'type' => 'INNER',
'table' => 'groupon_lists',
'alias' => 'GrouponList',
'conditions' => array(
'SoBookmark.groupon_list_id = GrouponList.id',
)
),
array(
'type' => 'INNER',
'table' => 'tw_counts',
'alias' => 'TwCount',
'conditions' => array(
'SoBookmark.groupon_list_id = TwCount.id',
)
),
),
);
$this->set($key, $this->SoBookmark->find('all', $options) );