Image describing the tables -> https://i.stack.imgur.com/ki2YP.jpg
Each of the tables is a model.
Main model which shows through CGridView is "RegularTask".
Now I need it to display fields from "YearlyTask" in the same row.
"hp_id" and "up_id" are FK (foreign keys) in both tables.
I tried to set the relations() in the RegularTask model like this:
'arp' => array(self::BELONGS_TO, 'YearlyTask', 'hp_id, up_id'),
Then I try to display the "is_sent" and "is_reported" fields from YearlyTask by using "arp.is_sent" and "arp.is_reported", but nothing shows up (not even error). While data from RegularTask displays normally.
What am I doing wrong?
Here is a snippet from the dataprovider..
<?php
$dataProvider=new CActiveDataProvider('RegularTask', array(
'criteria'=>array(
'condition'=>'t.id_id=' . $model->id,
'order'=>'t.created DESC',
'with'=>array('arp'),
),
'pagination'=>array(
'pageSize'=>10,
),
));
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'columns'=>array(
'comment',
'arp.is_sent'
),
));
?>