invoice is a view in DB and i want to show this view information in a CGridView form
this is my action:
public function actionInvoice()
{
$model= Invoice::model()->findAllBySql('select * from invoice where userid ='.Yii::app()->user->id);
$this->render('invoice',array('model'=>$model));
}
and this is my view:
<?php var_dump($model) ?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'UserAccountnumber-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'amount',
'time',
'status',
)
)
);
?>
but when i run this code i got an error :
Fatal error: Call to a member function search() on a non-object in C:\wamp\www\mypal\protected\views\user\invoice.php on line 5
i know this error is because of i send an array of model into the view but i dont know how to figure it out and show an array of models in a CGridView
tnx