예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Pastoreio::find();
     $query->joinWith('relIdPastor');
     $query->joinWith('relIdRebanho');
     $query->joinWith('relIdExploracao');
     // add conditions that should always apply here
     $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;
     }
     // grid filtering conditions
     /*$query->andFilterWhere([
           'idPastor' => $this->idPastor,
           'idRebanho' => $this->idRebanho,
           'data' => $this->data,
       ]);
       */
     $query->andFilterWhere(['like', 'Pessoa.nome', $this->idPastor])->andFilterWhere(['like', 'Rebanho.designacao', $this->idRebanho])->andFilterWhere(['like', 'Exploracao.nome', $this->idExploracao])->andFilterWhere(['like', 'data', $this->data]);
     return $dataProvider;
 }
예제 #2
0
파일: Rebanho.php 프로젝트: AnaSousa25/TcV
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPastoreios()
 {
     return $this->hasMany(Pastoreio::className(), ['idRebanho' => 'idRebanho']);
 }
예제 #3
0
파일: Pessoa.php 프로젝트: AnaSousa25/TcV
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPastoreios()
 {
     return $this->hasMany(Pastoreio::className(), ['idPastor' => 'idPessoa']);
 }
예제 #4
0
 /**
  * Finds the Pastoreio model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $idPastor
  * @param integer $idRebanho
  * @param string $idExploracao
  * @return Pastoreio the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($idPastor, $idRebanho, $idExploracao)
 {
     if (($model = Pastoreio::findOne(['idPastor' => $idPastor, 'idRebanho' => $idRebanho, 'idExploracao' => $idExploracao])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getPastoreios()
 {
     return $this->hasMany(Pastoreio::className(), ['idExploracao' => 'marca']);
 }