I have 2 tables: assistant and activity.
There is a realtion between both.
In table activity, there is a colum name “organizator_id” and a foreign key to “les_number” (in assistant table). But “les_number” isn’t the primary key of assistant table (I tell this because I don’t know if this could be the problem).
In assistant and activity model exist the relations:
'activities' => array(self::HAS_MANY, 'Activity', 'organizer_id'),
'organizer' => array(self::BELONGS_TO, 'Assistant', 'fk_activity_organizer'),
My problem is in the activity view, in CDetailView array I try to show the organizator name instead of id:
'attributes'=>array( ... asistant.name, ...
But in the view I see "Not Set".
I check the foreign key in the db with this query:
Could be because I’m not using primary key in the foreign key ? Do you know how could I fix this ?