cakephp 中连接查询多表 或group by
$options = array(
'conditions' => $conditions,
'fields'=>array('Category.*','COUNT(`Entity`.`id`) as `entity_count`'),
'joins' => array('LEFT JOIN `entities` AS Entity ON `Entity`.`category_id` = `Category`.`id`'),
'group' => '`Category`.`id`',
'contain' => array('Domain' => array('fields' => array('title')))
);
return $this->find('all', $options);