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'=>$model->search(),
'itemView'=>'_view',
));
?>
//======================This is render _view file======================
<div class="view">
<b><strong> <?php echo CHtml::encode($data->getAttributeLabel('name')); ?></strong>:</b>
<?php echo CHtml::encode($data->name); ?>
<br />
<b><?php echo CHtml::encode($data->getAttributeLabel('start_date')); ?>:</b>
<?php echo CHtml::encode($data->start_date); ?>
<br />
<b><?php echo CHtml::encode($data->getAttributeLabel('end_date')); ?>:</b>
<?php echo CHtml::encode($data->end_date); ?>
<br />
<h5>Notes</h5>
<?php
foreach ($notes as $notes) {
echo $note->description;
}
?>
<hr>
</div>