Yii Framework Forum: Three Table Join In Cdetailview - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Three Table Join In Cdetailview Rate Topic: -----

#1 User is offline   air_cooled 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 32
  • Joined: 11-September 12
  • Location:Australia

Posted 11 September 2012 - 08:41 AM

I've got an app with:


Contact

Address

Region

Where a Contact has an Address, and an Address has a Region.

When showing the Contact in CDetailView, I'd like to be able to show the Region name rather than the region_id which is a property of the Address.

I've already got this:

$this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
'id',
'name',
'address.address1',
'address.address2',
'address.city',
'address.region_id',

),

Which works fine, the address.whatever entries show the related data for the address object, but now I need to go that one step further, and I don't know if I can nest a second request here somehow, or build it into the controller and use it here... I'm fairly new to yii, although I'm enjoying it so far.

Hopefully someone can help.
Thanks
Every complex problem has a simple solution that is wrong.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users