Example #1
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTranslation()
 {
     $action_translation = CsActionsTranslation::find()->where('lang_code="SR" and action_id=' . $this->id)->one();
     if ($action_translation) {
         return $action_translation;
     }
     return false;
 }
 /**
  * Finds the CsServicesTranslation model based on its translated title.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return CsServices the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findActionByTitle($title)
 {
     if (($model = \common\models\CsActionsTranslation::find()->where('name=:name and lang_code="SR"', [':name' => str_replace('-', ' ', $title)])->one()) !== null) {
         return $model->action;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }