/**
  * 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 findServiceByTitle($title)
 {
     if (($model_tr = \common\models\CsServicesTranslation::find()->where('name=:name and lang_code="SR"', [':name' => str_replace('-', ' ', $title)])->one()) !== null) {
         // ako je našao ime usluge, renderuj stranicu - URL injection
         if ($model_tr and $model = $this->findService($model_tr->service_id)) {
             return $model;
         } else {
             throw new NotFoundHttpException('The requested page does not exist.');
         }
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 2
0
 /**
  * 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 findServiceByTitle($title)
 {
     if (($model = \common\models\CsServicesTranslation::find()->where('name=:name and lang_code="SR"', [':name' => str_replace('-', ' ', $title)])->one()) !== null) {
         $service = $this->findService($model->service_id);
         return $service;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTranslation()
 {
     $service_translation = CsServicesTranslation::find()->where('lang_code="SR" and service_id=' . $this->id)->one();
     if ($service_translation) {
         return $service_translation;
     }
     return false;
 }
Exemplo n.º 4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getServicesTranslations()
 {
     return $this->hasMany(CsServicesTranslation::className(), ['lang_code' => 'code']);
 }