Findall Method

I am using the findAll method to group a data by applying certain conditions.I am using this method as follows

$a=A::model->findAll(array(‘order’=>‘id’,‘group’=>‘area’));

I am getting the desired output …

But when I try to define a certain condition such as:

$a=A::model->findAll(‘a=b’,array(‘order’=>‘id’,‘group’=>‘area’));

It gives the desired output but doesn’t group as it was desired.Moreover if I use:

$a=A::model->findAll(array(‘order’=>‘id’,‘group’=>‘area’),‘a=b’);The first is processed,but not the second part.

NOTE:I am using a checkbox to render $a

try something as following


$c = new CDbCriteria;

$c->order = "id ASC";

$c->group = "area";

$c->condition="a=:a";

$c->params=array(":a"=>"b");


$a=A::model->findAll($c);