Undefined variable

Newbie on the rocks!

Got two tables and two models - order & orderdetails joined on one to many relation (same name applies for models).

 trying to send the orderdetails model related to the order models id to the order view(master) so the orderdetails(detail) are displayed in a gridview after the order details (master) are displayed. 


 


 on the view form (master), what should be the Gridview 'dataProvider' and  'filterModel' attributes contain. How is it performed. kindly





 


 //OrderController.php


 public function actionView($id){


	 return $this->render('view', ['model' => $this->findModel($id), 'model' => $orderDetails->findModel($id)]); //line 52


	 


 }


 


 


 


Undefined variable: orderDetails

PHP Notice – yii\base\ErrorException

Undefined variable: orderDetails

1. in C:\xampp\htdocs\yii2Basic\controllers\OrderController.php at line 51

orderDetails variable not defined, and dublicate key ‘model’ in render function.

$model = $this->findModel($id);

return $this->render(‘view’, [‘model’ => $model, ‘orderDetails’ => $model->getOrderDetails()->all()]);