Exemplo n.º 1
0
 /**
  * Lists all CustomerAddress models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new CustomerAddressSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $customerModel = '';
     if (isset(Yii::$app->request->queryParams['CustomerAddressSearch']['customer_id'])) {
         $customerModel = Customer::findOne(Yii::$app->request->queryParams['CustomerAddressSearch']['customer_id']);
     }
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'customerModel' => $customerModel]);
 }
Exemplo n.º 2
0
 /**
  * Finds the Customer model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Customer the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Customer::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }