php - Yii CActiveDataProvider returns wrong data -
i'm using 2 tables 1 many relation: campaign , group
this code returns relevant campaigns in group.
$models = campaigns::model()->with(array( 'campgroupassoc' => array('condition' => "groupid=$id"), ))->findall();
while code:
$dataprovider = new cactivedataprovider('campaigns', array( 'criteria' => array( 'with' => array( 'campgroupassoc' => array( 'condition' => "groupid=$id" ) ), ) ));
returns campaigns not in same group..
what doing wrong? thx
'campgroupassoc' => array( 'condition' => "groupid=:id", 'params'=>array(':id'=>$id) )
also better specify model groupid
belongs to. , of course can see sql dataprovider generating , analize it.
Comments
Post a Comment