/** * Finds the DctSolidFood model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return DctSolidFood the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { $model = DctSolidFood::find()->with('dctSolidFoodLocs')->where(['dct_solid_food_id' => $id])->one(); if ($model !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getDctSolidFood() { return $this->hasOne(DctSolidFood::className(), ['dct_solid_food_id' => 'dct_solid_food_id']); }
/** * Lists all Diary models. * @return mixed */ public function actionIndex() { $dataProvider = new ActiveDataProvider(['query' => Diary::find()]); $solidFood = DctSolidFood::find()->select('`dct_solid_food`.*, `dct_solid_food_loc`.`text` as text')->leftJoin('dct_solid_food_loc', '`dct_solid_food_loc`.`dct_solid_food_id` = `dct_solid_food`.`dct_solid_food_id`')->where(['dct_solid_food_loc.dct_language_id' => $this->currentLngId])->with('dctSolidFoodLocs')->asArray()->all(); return $this->render('index', ['dataProvider' => $dataProvider, 'solidFood' => $solidFood]); }
/** * Finds the DctSolidFood model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return DctSolidFood the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = DctSolidFood::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }