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