Hello.
view DzieckoHasRodzic
<h1>View DzieckoHasRodzic #<?php echo $model->dziecko_id; ?></h1>
<?php $this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
//'dziecko_id',
array('name'=>'dziecko.imie'),
//'rodzic_id',
array('name'=>'rodzic.imie'),
),
)); ?>
Relacje - table dziecko and rodzic have HAS_MANY
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'dziecko' => array(self::BELONGS_TO, 'Dziecko', 'dziecko_id'),
'rodzic' => array(self::BELONGS_TO, 'Rodzic', 'rodzic_id'),
);
}
Problem
I would like to view from my table (id, imie[eng. name], nazwisko[eng.lastname]) instead of id. I read about BELONGS_TO that you need only relation.column to change id from relation. What if I want to view name and lastname instead of id ?