Select Spacial Column From Database

i have this model load with relation.

with this i load users inbox message .

just i want to show custom column for example:

in senderUser relation i have 10 column in model but i want to just select username of message sender.

and in Inbox Model some column i have don’t want to load in this time.


$model = Inbox::model()->with(array('senderUser'))->findAll('receiveuser = :receiveuser', array(':receiveuser' => Yii::app()->user->id));

Why you don’t want to load some columns from the database?

i solve this.

in CGridView how to check a column named readed and changed row color if readed column is false or true ?

Oh, so great check this:




$model = Inbox::model()->

          	with(array(

                    	'senderUser'=>array(

                                        	'select'=> 'id, username'

                     	)

                 	))->findAll(array(

                          	'select'=>'id, some, columns',

                          	'condition'=>'receiveuser = :receiveuser',

                          	'params'=> array(':receiveuser' => Yii::app()->user->id),

                   	)   );



I hope it is useful:D.