Using Sql View In Relation

I am using SQL view (which is supporting primary key), I have created Model. But making a relationship with other. So how can i create a Relation (one-many) with out Primary?


thanks Fabrizio Caldarelli

I solve my problem using On

‘vmFilterData’ => array(self::HAS_MANY, ‘Vmfilters’, ‘’, ‘on’=>‘vmFilterData.VMID =’),

and define primary in Vmfilters

public function primaryKey()


        return 'id';


thank you sooooooooo much for quick response!!!!!!!!!

BUT still this is NOT working when using many relationships i.e with other tables Please any solution?