/** * Finds user by [[username]] * * @return User|null */ public function getUser() { if ($this->_user === false) { $this->_user = Tutor::findByUsername($this->username); } return $this->_user; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Tutor::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['idTutor' => $this->idTutor, 'idLocal_Trabalho_Tutor' => $this->idLocal_Trabalho_Tutor]); $query->andFilterWhere(['like', 'siap', $this->siap])->andFilterWhere(['like', 'nome', $this->nome])->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'password', $this->password])->andFilterWhere(['like', 'auth_key', $this->auth_key])->andFilterWhere(['like', 'access_token', $this->access_token])->andFilterWhere(['like', 'password_reset_token', $this->password_reset_token]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getIdTutor0() { return $this->hasOne(Tutor::className(), ['idTutor' => 'idTutor']); }
/** * @return \yii\db\ActiveQuery */ public function getTutors() { return $this->hasMany(Tutor::className(), ['idLocal_Trabalho_Tutor' => 'idLocal_Trabalho']); }
/** * Finds the Tutor model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Tutor the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Tutor::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }