Findallbyattributes To Return Pk For Filter Of Cgridview

Hi all,

Sorry to bother you.

I’m a newbie to yii.

Searched te web, the forum and the site but didn’t find a solution for a problem I’m having.

I need a dynamic filter using CGRIDVIEW.

I’ve set it up, working (hopefully good).

Now they can select a District from a list with the parent being the inputted afdeling. Displays fine but the moment you select a district from the provided list I get an sql error. Reason. The filter is not selecting the pk of the table afdeling (which has afdeling, district etc… in it). So now the solution is getting the pk of table afdeling instead of the parent_id.

Code :

if(Yii::app()->user->getState(‘district’) == NULL){

$arrayDistrict = array('id'=>'not null','parent'=>Yii::app()->user->getState('afdeling'));






} else {

print("District " . Yii::app()->user->getState('district') . " / ");


Can somebody point me in the right direction.

PS : I’m using $arrayDistrict because php has problem using multiple => in a sub-array.


Philip Van Daele