/**
  * Deletes a particular model.
  * If deletion is successful, the browser will be reload page.
  * @param integer $id the ID of the model to be deleted
  */
 public function actionDelete($id)
 {
     if (Yii::$app->request->isGet) {
         $sectionText = SectionText::deleteAll(['SectionId' => $id]);
         $this->loadModel($id)->delete();
         $this->redirect(['index']);
     }
 }
 /**
  * Validate the section name to
  * conform its is unique
  * @param string $name
  * @param int $id
  * @return boolean
  */
 private function validateSectionName($name, $id = 0)
 {
     $query = SectionText::find();
     $query->where(['Name' => trim($name)]);
     $query->andFilterWhere(['LCID' => Yii::$app->getModule('helpsystem')->languageCode]);
     if ($id) {
         $query->andFilterWhere(['!=', 'SectionId', $id]);
     }
     $result = $query->all();
     if (!empty($result)) {
         return false;
     } else {
         return true;
     }
 }
Example #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSectionTexts()
 {
     return $this->hasMany(SectionText::className(), ['LCID' => 'LCID']);
 }