Property is not defined

(Sh Humble) #1

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'));		



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






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

In view :: Index.php

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


	'dataProvider' => $dataProvider,

	'columns' => array(
















(Matteo Falsitta) #2

Is the relation message properly set?

(Sh Humble) #3

The relation for model Message is:

return array(

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


And for model Messageto is:

return array(



(Maurizio Domba Cerin) #4

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


you would use


(Sh Humble) #5

Thanks mdomba