public function actionAtributos($pasoId) { $model = new Atributos(); $model->pasoId = $pasoId; $atributos = Atributos::find()->where('pasoId = :pasoId', ['pasoId' => $pasoId])->all(); if ($model->load(Yii::$app->request->post()) && $model->save()) { $id = $model->tipoTramiteId; $model = new Atributos(); return $this->redirect(['atributos', 'model' => $model, 'atributos' => $atributos, 'pasoId' => $pasoId, 'id' => $id]); } else { return $this->render('atributos', ['model' => $model, 'atributos' => $atributos]); } }
/** * @return \yii\db\ActiveQuery */ public function getAtributos() { return $this->hasMany(Atributos::className(), ['tipoAtributoId' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getAtributo() { return $this->hasOne(Atributos::className(), ['id' => 'atributoId']); }
/** * Finds the Empleado model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Empleado the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Atributos::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function retriveAttr($attrid, $paso) { if (!$this->permisosPorPaso[$paso][USUARIOS::$LEER] && !$this->__salvando) { throw new ForbiddenHttpException('Informacion Restringida'); } if (!empty($this->_pasos[$paso][$attrid])) { return $this->_pasos[$paso][$attrid]; } $atributo = Atributos::find()->where(['id' => $attrid, 'tipoTramiteId' => $this->tipoDeTramite()])->one(); if (empty($atributo)) { throw new UnknownPropertyException('Setting unknown property: ' . get_class($this) . '::' . $attrid); } if (!empty($this->id)) { $valtemp = ValoresTramite::find()->where(['atributoId' => $atributo->id, 'tramiteId' => $this->id])->one(); if (!empty($valtemp)) { $this->_pasos[$paso][$attrid] = $valtemp; return $valtemp; } } $valor = new ValoresTramite(); $valor->atributoId = $atributo->id; $this->_pasos[$paso][$attrid] = $valor; return $valor; }