I have a many to many relationship between two tables, I am using a middle table with a composite key to connect the two tables together via this code in the relations() area.
'Track'=>array(self::MANY_MANY,'track','xref_panel2track(panel_id, track_id)'),
In my view I have a simple “zii.widgets.CDetailView” that I am using to present the data. All the data is presented fine except for the Track information that is part of the MANY to MANY relationship. I have tried both using the array() process shown below and the simple format of just putting ‘Track.name’, neither work.
<?php $this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
'requestor.username',
'name',
'description_short',
'description_long',
'notes',
array(
'label'=>'Track',
'type'=>'raw',
'value'=>$model->Track["name"],
),
'panelType.name',
'panelStatus.name',
'submitted',
),
)); ?>
I do a print_r($model->Track) and can see that the data is there but when I try and reference it I get “Not Set”, which is the value used when the data is NULL. I am assuming that this has something to do with the data being a potential array since this is a MANY to MANY relationship, but for the life of me I can’t find any solutions in all my searches.
From print_r($model->Track):
Array ( [id] => 9125f93c-50af-11df-942b-003048333d92 [name] => Comics [description] => Comics Track )
Any and all help is greatly appreciated as I am at a complete loss on what is wrong here.