Having Many to Many presentation layer issues

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(

















)); ?>

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.

Have you tryed $model->Track->name

Yes, I think I have tried all possible values and really wondering if this is a 3 dimensional array instead of a 2D.

If it’s a many-many relation the ‘name’ of which result should be picked? Know what i mean?!

You could use





to pick the name of the first result (track) or you need to reduce all tracks into one string.


Ah, thank you so much, I new it was a 3D, just brain farted on how to get to it… Much appreciated… =D