Hello. I’m new to Yii and currently having difficulties with creating CActiveDataProvider.
I’ve created this criteria :
$criteria=new CDbCriteria;
$criteria->compare('cr',$this->cr);
$criteria->compare('status',$this->status);
$criteria->compare('created_by',$this->created_by);
$criteria->compare('created_at',$this->created_at,true);
$criteria->with = array(
'rT' => array(
'alias' => 'r',
),
'rT.bs' => array(
'alias' => 's',
'joinType' => 'INNER JOIN',
'condition' => 's.cid = :cid',
'params' => array(':cid' => $_SESSION['cid']),
),
);
When passing the criteria to CActiveDataProvider and viewing at CListView, I get results which ignores the condition. (Suppose to have 10 results, but instead I get all the results.) If I put the condition outside the ‘with’ array, then I’ll get ‘unknown column in where clause’ error.
Any help is highly appreciated.