How can both be primary key? The first table has a field (foreign key) that holds a value from the field of the other table… in the other table the referenced field it’s good if it is the primary key… but it does not have to be…
use ‘on’ when declaring the relation
If you haven’t done yet… read first the Definitive guide to Yii and the Yii blog tutorial… and do not just read… do the examples… .create the default application…