I have two tables
big (id, bigs_name, smallid),
small(id, smallguys_name)
therefore two models - big and small
i have used the following relation in the big model, (I hope this relation is correct)
'has_small' => array(self::HAS_ONE, 'small', 'smallid')
by default the actionIndex was created as
public function actionIndex()
{
$dataProvider=new CActiveDataProvider('IphoneSubscription');
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
In the _view.php I want to display 'smallguys_name' in place of 'smallid' which is displayed by default. That is in normal php I would have taken 'smallid' and selected the corrected row from 'small'. How do I do it in yii?
I have this in _view.php -
echo $data->smallid;
output - the id from 'big'
I tried this -
echo $data->has_small->smallguys_name;
and i get the following CDbException
Column not found: 1054 Unknown column 'has_small.smallid' in 'where clause'
thanks for the help