/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = ProyectoUsuarioAsignar::find(); //Join para la relacion $query->joinWith(['proyecto']); $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; } $query->andFilterWhere(['id' => $this->id, 'usuario_id' => $this->usuario_id, 'proyecto_id' => $this->proyecto_id, 'accion_especifica_id' => $this->accion_especifica_id, 'proyecto_usuario_asignar.estatus' => $this->estatus]); $query->andFilterWhere(['proyecto.aprobado' => $this->aprobado]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getAsignado0() { return $this->hasOne(ProyectoUsuarioAsignar::className(), ['id' => 'asignado']); }
/** * Finds the ProyectoAsignar model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return ProyectoAsignar the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = ProyectoUsuarioAsignar::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }