I have a difficulty using 'conditions'. I'm trying get record which have stage_id in (1,2,3,4) and group them by stage_id.
I know how to do it with SQLBuilder but would like to use finder conditions:
SQLBuilder solution: (it works)
$conn = ActiveRecord\ConnectionManager::get_connection("development");
$builder = new ActiveRecord\SQLBuilder($conn, "matches");
$builder->where("stage_id in (1,2,3,4)");
$builder->group("stage_id");
Subject: "group by" clause
Hi guys,
I have a difficulty using 'conditions'. I'm trying get record which have stage_id in (1,2,3,4) and group them by stage_id.
I know how to do it with SQLBuilder but would like to use finder conditions:
SQLBuilder solution: (it works)
$conn = ActiveRecord\ConnectionManager::get_connection("development"); $builder = new ActiveRecord\SQLBuilder($conn, "matches"); $builder->where("stage_id in (1,2,3,4)"); $builder->group("stage_id");finder version: (it doesn't work)
$cond = array( 'conditions' => array('stage_id in (?)', array(1,2,3,4), 'group', 'stage_id') ); $this->view_data['matches'] = Match::find('all', $cond);Any ideas?