public function getMyValue()
 {
     // UserEventText
     $uet = UserEventText::find()->where(['id_user' => Yii::$app->user->identity->id])->andFilterWhere(['id_device' => $this->id_dev, 'templ' => $this->mkey, 'code' => $this->value]);
     //->one();
     // получаем запрос вида
     // SELECT * FROM `user_event_text` WHERE (`id_user`=2) AND ((`id_device`=289) AND (`templ`='zone.1') AND (`code`='-'))
     //return $uet->count();
     if ($uet->count() == 0) {
         return $this->value;
     }
     return $uet->one()->text;
     //return 'Мое значение';
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = UserEventText::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'id_user' => $this->id_user, 'id_device' => $this->id_device]);
     $query->andFilterWhere(['like', 'templ', $this->templ])->andFilterWhere(['like', 'code', $this->code])->andFilterWhere(['like', 'text', $this->text]);
     return $dataProvider;
 }
 /**
  * Finds the UserEventText model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return UserEventText the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = UserEventText::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }