Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Inscricao::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $query->joinWith(['candidato']);
     $dataProvider->sort->attributes['candidato'] = ['asc' => ['candidato.nome' => SORT_ASC], 'desc' => ['candidato.nome' => SORT_DESC], 'label' => 'Candidato'];
     $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(['idinscricao' => $this->idinscricao, 'data' => $this->data, 'caixa_idcaixa' => $this->caixa_idcaixa, 'candidato_idcandidato' => $this->candidato_idcandidato])->andFilterWhere(['like', 'candidato.nome', $this->candidato]);
     return $dataProvider;
 }
Пример #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getInscricao()
 {
     return $this->hasOne(Inscricao::className(), ['idinscricao' => 'inscricao_idinscricao']);
 }
Пример #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getInscricoes()
 {
     return $this->hasMany(Inscricao::className(), ['idinscricao' => 'inscricao_idinscricao'])->viaTable('inscricao_prova_sala', ['prova_idprova' => 'idprova']);
 }
Пример #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getInscricoes()
 {
     return $this->hasMany(Inscricao::className(), ['caixa_idcaixa' => 'idcaixa']);
 }
Пример #5
0
 /**
  * Finds the Inscricao model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Inscricao the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Inscricao::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }