/** * Finds the Matvid model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Matvid the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Matvid::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function searchforgrupavid($params) { $query = Matvid::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['matvid_name' => SORT_ASC]]]); $query->joinWith(['grupavids']); $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(['matvid_id' => $this->matvid_id]); $query->andFilterWhere(['like', 'matvid_name', $this->matvid_name]); $query->andFilterWhere(['like', 'grupavids.grupa_main', $this->getAttribute('grupavids.grupa_main')]); Proc::AssignRelatedAttributes($dataProvider, ['grupavids.grupa_main']); return $dataProvider; }
/** * @depends loadData */ public function destroyData() { Mattraffic::deleteAll(); Material::deleteAll(); Employee::deleteAll(); Matvid::deleteAll(); Izmer::deleteAll(); Schetuchet::deleteAll(); Authuser::deleteAll('auth_user_id <> 1'); Build::deleteAll(); Dolzh::deleteAll(); Podraz::deleteAll(); }
/** * @return \yii\db\ActiveQuery */ public function getIdmatvid() { return $this->hasOne(Matvid::className(), ['matvid_id' => 'id_matvid'])->from(['idmatvid' => Matvid::tableName()]); }
/** * @depends loadData */ public function destroyData() { Grupavid::deleteAll(); Grupa::deleteAll(); Matvid::deleteAll(); }