Yii Framework Want To Fetch 3 Model In Single Actioncontroller And Post Using Single Activedataprovider

Yii Framework want to fetch 3 model in single actioncontroller and post using single ActiveDataProvider

////////////////////////////

I have this Action in my controller

public function actionIndex() {

    $this->layout = 'column3';


    $model = new Projects('search');


    $model->unsetAttributes();


    $test = $model->contact_id = Yii::app()->User->id;


    $myid = Projects::model()->findByAttributes(


            array(


                'contact_id' => $test


            ));


    $notes = Notes::model()->findByAttributes(array(


        'parent_id' => $myid->id,


        'parent_type' => "Projects"


            ));


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


        'model' => $model,


        'notes' => $notes


    ));


}

//=======================View Index File==============================

//=====================I Am using BListView in index.php View Page====

<?php

$this->widget(‘bootstrap.widgets.TbListView’, array(

'dataProvider'=&gt;&#036;model-&gt;search(),


'itemView'=&gt;'_view',

));

?>

//======================This is render _view file======================

<div class="view">

&lt;b&gt;&lt;strong&gt; &lt;?php echo CHtml::encode(&#036;data-&gt;getAttributeLabel('name')); ?&gt;&lt;/strong&gt;:&lt;/b&gt;


&lt;?php echo CHtml::encode(&#036;data-&gt;name); ?&gt;


&lt;br /&gt;





&lt;b&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;getAttributeLabel('start_date')); ?&gt;:&lt;/b&gt;


&lt;?php echo CHtml::encode(&#036;data-&gt;start_date); ?&gt;


&lt;br /&gt;





&lt;b&gt;&lt;?php echo CHtml::encode(&#036;data-&gt;getAttributeLabel('end_date')); ?&gt;:&lt;/b&gt;


&lt;?php echo CHtml::encode(&#036;data-&gt;end_date); ?&gt;


&lt;br /&gt;





&lt;h5&gt;Notes&lt;/h5&gt;





&lt;?php





foreach (&#036;notes as &#036;notes) {


    echo &#036;note-&gt;description;


}


?&gt;





&lt;hr&gt;

</div>

chek below links , will help about quering related models

relational query options

http://www.yiiframew…l-query-options

performing relation query

http://www.yiiframew…elational-query