i have to display block name in view where i am presently displaying id. block name is a dropdown which i am getting from a model called block and i am using rev_block_name in another model for storing this value.
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'columns'=>array(
// display the 'content' attribute as purified HTML
array( // display 'create_time' using an expression
'name'=>'rev_block_id',
'value'=>'$data->rev_block_id',
),
array( // display 'create_time' using an expression
'name'=>'rev_flat_number',
'value'=>'$data->rev_flat_number',
),
array( // display 'create_time' using an expression
'name'=>'rev_instrument_number',
'value'=>'$data->rev_instrument_number',
), ),
)); ?>
i know rev_block_id but i need to get block_name here which is in another model:block.
All my dbs have relationships in them. I have never done so without so I can’t say for sure about just defining in the model. If there are no associated attributes I don’t see how it would work. Maybe someone else can answer?
you only need to proper declare relations() method in Revenue model. But it will be good also define foreign key in DB to ensure data consistency if your DBMS support that.
as my application is almost done so i dont want to change my database schema.so i am trying to display name in my view without using relation.Is it possible?