/** * 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 findModelByTitle($title) { if (($model = \common\models\CsObjectsTranslation::find()->where('name=:name and lang_code="SR"', [':name' => str_replace('-', ' ', $title)])->one()) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getTranslation() { $object_translation = CsObjectsTranslation::find()->where('lang_code="SR" and object_id=' . $this->id)->one(); if ($object_translation) { return $object_translation; } return false; }