Property is not defined

Hello friend

I got an error followed by Property "Messageto.Message" is not defined.

Any idea to solve??

I have two modules: Message and Messageto

In MessageController





public function actionIndex()

{

		/**

	     * acess records of authentic user only

	     */

		$currentUserId = Yii::app()->user->id;	

			

		$criteria =  new CDbCriteria;		

		

		$criteria->with=array('message'=>array('on'=>'message.authorId=t.authorId AND message.messageId=t.messageId AND message.threadOf=0 AND t.memberId='.$currentUserId,'joinType'=>'INNER JOIN'));		

		$criteria->addCondition("t.messageStatusId=1");	

		

		$dataProvider=new CActiveDataProvider('Messageto', array('criteria'=>$criteria));

		

		$this->render('index',array(

			'dataProvider'=>$dataProvider,

		));

}




When I check the query statement, it gives the desired result.

In view :: Index.php





$this->widget('zii.widgets.grid.CGridView', array(

	'id'=>'message-grid',

	'dataProvider' => $dataProvider,

	'columns' => array(

			array('name'=>'From',

		      	'type'=>'raw',

		      	'value'=>'Message::thumbImageAndName($data->authorId)',

			),

			array('name'=>'Subject',

		      	'value'=>'$data->Message->messageSubject',				

			),

			array('name'=>'Date',

		      	'value'=>'$data->Message->messageTime',			

			),

			array(

			'class'=>'CButtonColumn',

			),

		),		

	));



Is the relation message properly set?

The relation for model Message is:





return array(

			'messageto' => array(self::HAS_MANY,'Messageto','messageId'),				

		);



And for model Messageto is:





return array(

			'message'=>array(self::BELONGS_TO,'Message','messageId'),			

			);



Could be the first letter case…

note that the error say "Messageto.Message" (Message with first letter upercase)… but the relation in Messageto is "message" (first letter lowercase)

so instead of


'value'=>'$data->Message->messageSubject', 

you would use


'value'=>'$data->message->messageSubject', 

Thanks mdomba