/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Exploracao::find(); $query->joinWith('relIdDono'); // 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([ // 'idDono' => $this->idDono, //]); $query->andFilterWhere(['like', 'marca', $this->marca])->andFilterWhere(['like', 'Exploracao.nome', $this->nome])->andFilterWhere(['like', 'Pessoa.nome', $this->idDono]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getRelIdExploracao() { return $this->hasOne(Exploracao::className(), ['marca' => 'idExploracao']); }
$form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'nome')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'parcelario')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'local')->textInput(['maxlength' => true]); ?> <?php echo $form->field($model, 'marcaExploracao')->dropDownList(ArrayHelper::map(Exploracao::find()->all(), 'marca', 'nome'), ['prompt' => 'Escolher Exploração']); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Criar' : 'Atualizar', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end(); ?> </div>
/** * Finds the Exploracao model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Exploracao the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Exploracao::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getMarcaExploracao0() { return $this->hasOne(Exploracao::className(), ['marca' => 'marcaExploracao']); }
/** * @return \yii\db\ActiveQuery */ public function getExploracaos() { return $this->hasMany(Exploracao::className(), ['idDono' => 'idPessoa']); }