I have a table -> tbl_staff (id , name)
and I have written a function in my staff model :
public function oddOrEven ()
{
if ($this->id % 2 == 0) return ‘even’
else return ‘odd’;
}
now I want to return all odd recoeds and use a dataprovider to show these records
Note : I DONT WANT to use the SQL statements in the criteria like this
$dataProvider=new CActiveDataProvider(‘MstTender’,
array(
'criteria' => array(
'condition'=>'id % 2 = 1,
),
)
);
I want to use my oddOrEven directly something like this :
$dataProvider=new CActiveDataProvider(‘MstTender’,
array(
'criteria' => array(
'condition'=>oddOrEven .'=odd',
),
)
);
but it is not correct can u guide plz?