/**
  * Finds user by [[username]]
  *
  * @return User|null
  */
 public function getUser()
 {
     if ($this->_user === false) {
         $this->_user = Bolsista::findByUsername($this->username);
     }
     return $this->_user;
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Bolsista::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(['idBolsista' => $this->idBolsista, 'horas_trabalhadas' => $this->horas_trabalhadas, 'idTutor' => $this->idTutor, 'idLocal_Trabalho' => $this->idLocal_Trabalho]);
     $query->andFilterWhere(['like', 'nome', $this->nome])->andFilterWhere(['like', 'turno', $this->turno])->andFilterWhere(['like', 'matricula', $this->matricula]);
     return $dataProvider;
 }
 /**
  * Finds the Bolsista model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Bolsista the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Bolsista::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBolsistas()
 {
     return $this->hasMany(Bolsista::className(), ['idHorario_Trabalho' => 'idHorario_Trabalho']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getBolsistas()
 {
     return $this->hasMany(Bolsista::className(), ['idTutor' => 'idTutor']);
 }