Exemplo n.º 1
0
 /**
  * Finds the Address model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Address the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Address::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 2
0
 /**
  * Find model by ID.
  *
  * @param integer|array $id Comment ID
  * @return Comment Model
  * @throws HttpException 404 error if comment not found
  */
 protected function findModel($id)
 {
     /** @var Comment $model */
     $model = Address::findOne($id);
     if ($model !== null) {
         return $model;
     } else {
         throw new HttpException(404, \Yii::t('net_frenzel_address', 'FRONTEND_FLASH_RECORD_NOT_FOUND'));
     }
 }