Пример #1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAbschlags()
 {
     return $this->hasMany(Abschlag::className(), ['datenblatt_id' => 'id']);
 }
 /**
  * Deletes abschlag
  * @param integer $id
  * @return mixed
  */
 public function actionDeleteabschlag($datenblattId, $abschlagId)
 {
     $model = $this->findModel($datenblattId);
     if ($modelAbschlag = Abschlag::findOne($abschlagId)) {
         $modelAbschlag->delete();
     }
     return $this->redirect(['update', 'id' => $datenblattId]);
 }
 /**
  * Finds the Abschlag model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Abschlag the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Abschlag::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }