I want to show a other model field in my cgrid view , I am using yii model. My current model is Members and other model is Billing: My Code:
public function getImportantMembers(){
$criteria = new CDbCriteria;
$criteria->select ='t.*,b.billing_id,b.amount,b.billing_date,b.member_id,b.billing_status';
$criteria->join = 'JOIN billing AS b ON b.member_id = t.id ';
if(isset($_GET['condition']) AND $_GET['condition'] > 0){
$condition = $this->getConditionForImportantMembers($_GET['condition']);
$criteria->addCondition($condition);
}
else{
$criteria->addCondition("b.billing_date > DATE_SUB(NOW(),INTERVAL 2 MONTH) AND b.billing_status='c' AND b.amount >= 150 AND t.status='a'");
}
$criteria->group = 't.id';
return new CActiveDataProvider(get_class($this), array(
'criteria'=>$criteria,
'pagination'=>array(
'pageSize'=> Yii::app()->user->getState('pageSize',Yii::app()->params['defaultPageSize']),
),
));
}