Problem With Relation

i have two models BaseReceivedItem and BaseRefSiDetails

BaseReceivedItem model relation




public function relations(){	

	return array(

		'details' => array(self::BELONGS_TO, 'BaseRefSiDetails', 'details_id'),

		);

	}



BaseRefSiDetails model relation




public function relations(){	

	return array(

		'siReceivedItems' => array(self::HAS_MANY, 'BaseSiReceivedItem', 'details_id'),

		);

	}



i need to display datas from baseresidetails into the grid of basereceiveditem

i use this




$data->details->stockno;



but no results found please help .

Dear Friend

It should be like this.




'columns'=>array(

		'id',


		'details.stockno',

......................................

.........................................

                  

)



or

it should be




'columns'=>array(

		'id',


               array(

                 'name'=>'someName',

                  'value'=>'$data->details->stockno',

                   ),

......................................

.........................................

                  

)



Regards.

i tried it before but same no results maybe theres problem on my relations …

Hi

Check out the SQL query that is built. Either by logging to a file or using the Yii Debug Toolbar Extension .

Verify what is going on by testing the query in phpmyadmin for instance and adjust the query until you get results (probably removing some of the conditions). Determine how that should impact your models.

how can i test the query ??

le_top described it…