Hi,
I’m having trouble figuring out how to run a query where the criteria is in a related table.
I’ve got two tables in a many to many relationship
and my controller is
public function actionAdmin()
{
$dataProvider=new CActiveDataProvider('table1', array(
'criteria'=>array(
'with'=>array('table2'),
'condition'=>'id=:table2.table1_id AND User_id =' .Yii::app()->user->id,
'pagination'=>array(
'pageSize'=>self::PAGE_SIZE,
),
));
//Set new property
//$dataProvider->joinAll = true;
$this->render('admin',array(
'dataProvider'=>$dataProvider,
));
}
I got this error
CDbCommand failed to execute the SQL statement: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound
Do you have any idea where is the problem